ProGuard rules
When using ProGuard or R8 for code obfuscation and optimization, you need to add specific rules to ensure the Taboola SDK functions correctly.
Implementation
- Open your app module's
proguard-rules.pro
file. - Add the appropriate rules for your integration (see below).
These rules prevent the Taboola SDK from being obfuscated, ensuring proper functionality.
- Rebuild your project to apply the ProGuard rules.
Test your app thoroughly to ensure all functionality works correctly.
General rules
Add the following rules to your proguard-rules.pro
file:
# Taboola SDK ProGuard Rules
# Keep Taboola SDK classes
-keep class com.taboola.lightnetwork.* { *; }
# Keep AndroidX scrolling interfaces (required for RecyclerView integration)
-keep interface androidx.core.view.NestedScrollingChild
-keep interface androidx.core.view.NestedScrollingChild2
-keep interface androidx.core.view.NestedScrollingChild3
-keep interface androidx.core.view.ScrollingView
The AndroidX scrolling interfaces are required for HP4U
RecyclerView
integration
Meta SDK integration
If your app also integrates with Meta SDK, add these additional rules:
# Meta SDK ProGuard Rules (if using Facebook SDK)
# Suppress warnings for Meta SDK
-dontwarn com.facebook.infer.annotation.**
# Keep Meta SDK annotation classes
-keep class com.facebook.infer.annotation.** { *; }
Updated about 12 hours ago