Configure ProGuard

View the suggested configuration for ProGuard.


📘

If you used Gradle to import the JW Player SDK for Android or downloaded the JW Player SDK for Android Open Source Demo, JW Player's consumer-proguard.pro configuration has been applied automatically. You can skip this article and configure the manifest.


Implementation

If you used the Local approach, no ProGuard configuration has been added. If you choose to obfuscate your code with ProGuard, add the following ProGuard configuration.

This suggested ProGuard configuration ensures that the JW Player SDK for Android will work as intended.


-keepclassmembers class com.longtailvideo.jwplayer.** {
   @android.webkit.JavascriptInterface *;
}

# Block warnings about missing module classes
-dontwarn com.longtailvideo.jwplayer.**
-dontwarn com.google.ads.interactivemedia.**

# Classes get rejected without this when running the app if the app has been run through ProGuard
-keepattributes InnerClasses,EnclosingMethod

# Keep module indicator classes
-keep class com.longtailvideo.jwplayer.modules.** { *; }

# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*

# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform

-keep class com.google.common.** { *; }
-dontwarn com.google.common.**

-keep class com.google.android.exoplayer2.** { *; }
-dontwarn com.google.android.exoplayer2.**


Did this page help you?