Skip to main content

R8 / ProGuard

R8

R8 is the current code shrinker from Google.

If you use SmartLib as a dependency in an Android project which uses R8 as a default compiler you don’t have to do anything. The specific rules are already bundled into the AAR which can be interpreted by R8 automatically.

R8 is enabled by default from the Android Gradle plugin 3.4.0 and higher.

ProGuard

If you, however, don’t use R8 you have to apply the following rules.

# SmartLib public
-keep class tv.broadpeak.smartlib.SmartLib { *; }
-keep interface tv.broadpeak.smartlib.** { *; }
-keep public interface tv.broadpeak.smartlib.SmartLib$NanoCDNReceiver { *; }
-keep class tv.broadpeak.smartlib.ad.AdManager { *; }
-keep public interface tv.broadpeak.smartlib.ad.AdManager$AdEventsListener { *; }
-keep class tv.broadpeak.smartlib.engine.manager.LoggerManager { *; }
-keep public interface tv.broadpeak.smartlib.engine.manager.LoggerManager$LogRedirectListener { *; }

# SmartLib private
-keep class tv.broadpeak.smartlib.engine.executor.CoreWorker { *; }
-keep class tv.broadpeak.smartlib.engine.executor.MotorJSValueCallback { *; }
-keep class tv.broadpeak.smartlib.engine.executor.MotorJSStringCallback { *; }
-keep class tv.broadpeak.smartlib.engine.CoreEngine { *; }
-keep class tv.broadpeak.smartlib.engine.player.PlayerAdapterHandler { *; }
-keep class tv.broadpeak.smartlib.engine.player.PlayerManagerHandler { *; }
-keep class tv.broadpeak.smartlib.engine.system.DiversityHandler { *; }
-keep class tv.broadpeak.smartlib.engine.system.LoggerHandler { *; }
-keep class tv.broadpeak.smartlib.engine.system.MdnsHandler { *; }
-keep class tv.broadpeak.smartlib.engine.system.RequestHandler { *; }
-keep class tv.broadpeak.smartlib.engine.system.CacheHandler { *; }
-keep class tv.broadpeak.smartlib.ad.InternalAdManager { *; }
-keep class tv.broadpeak.smartlib.ad.pal.AdPalManager { *; }
-keep class tv.broadpeak.smartlib.ad.pal.AdPalManager17_1_0 { *; }
-keep class tv.broadpeak.smartlib.ad.pal.AdPalManager16_3_4 { *; }
-keep class tv.broadpeak.smartlib.SmartLib$* { *; }
-keep class tv.broadpeak.smartlib.session.streaming.AbstractSession { *; }
-keep class tv.broadpeak.smartlib.session.streaming.StreamingSession* { *; }
-keep class tv.broadpeak.smartlib.session.streaming.StreamingSession$* { *; }
-keep class tv.broadpeak.smartlib.session.analytics.AnalyticsSession { *; }
-keep class tv.broadpeak.smartlib.request.RequestManager* { *; }
-keep class tv.broadpeak.smartlib.request.RequestManager$* { *; }

# SmartLib player
-keep class tv.broadpeak.smartlib.player.ExoPlayerAdapter { *; }
-keep class tv.broadpeak.smartlib.player.ExoPlayerAdapterSupport2_12_0 { *; }
-keep class tv.broadpeak.smartlib.player.ExoPlayerAdapterSupport { *; }
-keep class tv.broadpeak.smartlib.player.Media3Adapter { *; }
-keep class tv.broadpeak.smartlib.player.GenericPlayerAdapter { *; }
-keep class tv.broadpeak.smartlib.player.LabgencyPlayerAdapter { *; }
-keep class tv.broadpeak.smartlib.player.VisualOnPlayerAdapter { *; }
-keep class tv.broadpeak.smartlib.player.VOPlayerAdapter { *; }
-keep class tv.broadpeak.smartlib.player.KalturaPlayerAdapter { *; }
-keep class tv.broadpeak.smartlib.player.ConnectPlayerAdapter { *; }
-keep class tv.broadpeak.smartlib.player.THEOPlayerAdapter { *; }

# Broadpeak MotorJS
-keep class tv.broadpeak.motorjs.** { *; }
-keep interface tv.broadpeak.motorjs.** { *; }
-keep class com.hippo.quickjs.android.** { *; }
-keep interface com.hippo.quickjs.android.** { *; }

# PAL SDK 16.3.4
-keep class com.google.ads.interactivemedia.pal.* { *; }
-keep public interface com.google.ads.interactivemedia.pal.NonceGenerator$NonceGeneratorCallback { *; }

# PAL SDK 17.1.0
-keep class com.google.ads.interactivemedia.pal.* { *; }
-keep class com.google.ads.interactivemedia.pal.NonceRequest$Builder { *; }
-keep interface com.google.android.gms.tasks.OnSuccessListener { *; }
-keep interface com.google.android.gms.tasks.OnFailureListener { *; }
-keep class com.google.android.gms.tasks.Task { *; }

# OM SDK Plugin
-keep class tv.broadpeak.smartlib.plugins.omsdk.OMSDKPlugin { *; }
-keep class tv.broadpeak.smartlib.plugins.omsdk.OMSDKHandler { *; }
-keep class tv.broadpeak.smartlib.plugins.omsdk.OMAdSession { *; }

# Diversity Plugin
-keep class tv.broadpeak.smartlib.plugins.diversity.DiversityHandler { *; }

# CONNECT Player
-keepclassmembers class nagra.otv.sdk.OTVVideoView {
private nagra.otv.sdk.OTVMediaPlayer mPlayer;
}
-keepclassmembers class nagra.otv.sdk.OTVMediaPlayer {
private com.google.android.exoplayer2.ExoPlayer mExoPlayer;
}

# Kaltura Player
-keep class com.kaltura.tvplayer.KalturaPlayer { *; }
-keep class com.kaltura.playkit.PlayerLoader { *; }
-keep class com.kaltura.android.exoplayer2.ExoPlayer { *; }

# OkHttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
-dontnote okhttp3.**
-dontnote okio.**
-dontwarn javax.annotation.**
-dontwarn org.codehaus.mojo.animal_sniffer.*