Skip to main content

ProGuard Rules

ProGuard optimizes and obfuscates Android release builds. Add these rules to ensure Apptrove SDK functions correctly.

Step 1: Add ProGuard Rules​

Create Platforms/Android/proguard-rules.pro:

# Apptrove SDK Rules
-keep class com.trackier.sdk.** { *; }
-keepclassmembers class com.trackier.sdk.** { *; }

# Google Play Services
-keep class com.google.android.gms.common.ConnectionResult {
int SUCCESS;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
java.lang.String getId();
boolean isLimitAdTrackingEnabled();
}

# Install Referrer
-keep public class com.android.installreferrer.** { *; }

# Kotlin
-keep class kotlin.Metadata { *; }
-keep class kotlin.** { *; }
-dontwarn kotlin.**

# WorkManager classes used for background install/event uploads. WorkManager's own
# consumer rules keep these classes but not their constructors; stricter R8 builds
# can still strip them, which then fails with "Could not create Input Merger".
-keep class * extends androidx.work.InputMerger { public <init>(); }
-keep class * extends androidx.work.ListenableWorker {
public <init>(android.content.Context, androidx.work.WorkerParameters);
}

Step 2: Configure .csproj​

<PropertyGroup Condition="$(TargetFramework.Contains('-android')) and '$(Configuration)' == 'Release'">
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<AndroidEnableProguard>true</AndroidEnableProguard>
<AndroidProguardConfigFile>Platforms\Android\proguard-rules.pro</AndroidProguardConfigFile>
</PropertyGroup>

Step 3: Test Release Build​

dotnet build -c Release -f net10.0-android

Troubleshooting​

IssueSolution
SDK not working in releaseVerify all ProGuard rules are added
Build errorsCheck ProGuard syntax
Tracking data missingTemporarily disable ProGuard to isolate issue
"Could not create Input Merger" crash (seen with newer R8, e.g. after upgrading to Gradle 9)Add the WorkManager rules shown above

For support, contact support@trackier.com.