Skip to main content
Version: 1.0.2

Configure R8/Proguard Rules for Appxiom SDK in Android

To ensure Appxiom SDK functions correctly in your Android release builds, you must configure R8/Proguard rules to prevent essential classes and annotations from being obfuscated. Proper configuration also preserves stacktrace details for effective debugging and error analysis in the Appxiom dashboard.

Required Proguard Rules​

Add the following rules to your proguard-rules.pro file:

-keep class tech.appxiom.android.core.* { *; }

-keepclassmembers class * {
@tech.appxiom.android.core.annotation.AX *;
}

-keepclassmembers class androidx.lifecycle.** {
*;
}

These rules ensure that Appxiom SDK core classes and the @AX annotation are retained and not obfuscated during the build process.

Preserve Source File and Line Numbers​

To keep exact line numbers and source file names in stacktraces (for accurate deobfuscation and debugging), add:

-keepattributes SourceFile,LineNumberTable

Mapping File Backup​

Always back up the mapping file for each production build. This file is required to deobfuscate stacktraces in the Appxiom dashboard.

Location of mapping file:
project-folder/app/build/outputs/mapping/release/mapping.txt


Frequently Asked Questions (FAQ)​

Q: Why do I need to add Proguard rules for Appxiom SDK?
A: Proguard and R8 obfuscate code to reduce app size and protect intellectual property. The rules above ensure Appxiom SDK classes and annotations are not removed or renamed.

Q: What happens if I do not add these rules?
A: The SDK will fail to report issue to Appxiom dashboard.

Q: Why should I keep the mapping file?
A: The mapping file is required to deobfuscate stacktraces, allowing you to trace errors back to your original source code.

Q: Where is the mapping file located?
A: The mapping file is generated at project-folder/app/build/outputs/mapping/release/mapping.txt after each release build.

Q: Do I need to update Proguard rules for every SDK update?
A: Review the release notes for each SDK update.

Q: Does this configuration affect app performance?
A: No, these rules only affect code obfuscation and stacktrace readability, not runtime performance.

Q: Is this required for debug builds?
A: Proguard/R8 is typically only enabled for release builds, but you can apply these rules to debug builds if you use obfuscation there as well.