Proguard Google Analytics

Does anyone know the keep statement that needs to be added to Proguard for Google Analytics?

I have this line right now, but for some reason nothing is reported ...

# google analytics, uncomment if using: -keep class com.google.android.apps.analytics.PipelinedRequester$Callbacks 
+6
source share
2 answers

I have a common

 -keep public class com.google.** {*;} 

in my proguard.cfg and google analytics works fine.

Try it. If this does not solve the problem, then your problem is not with Proguard, but rather with Google Analytics configuration or connection problems.

+17
source

You can find the official proguard rules file in the aar package, find it at:

android-sdk-windows \ extras \ google \ m2repository \ com \ google \ android \ gms \ butt service analytics \ xxx \ play-service analytics-xxxaar

proguard.txt:

 -keep class * extends java.util.ListResourceBundle { protected java.lang.Object[][] getContents(); } # Keep SafeParcelable value, needed for reflection. This is required to support backwards # compatibility of some classes. -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { public static final *** NULL; } # Keep the names of classes/members we need for client functionality. -keepnames @com.google.android.gms.common.annotation.KeepName class * -keepclassmembernames class * { @com.google.android.gms.common.annotation.KeepName *; } # Needed for Parcelable/SafeParcelable Creators to not get stripped -keepnames class * implements android.os.Parcelable { public static final ** CREATOR; } # Needed when building against the Marshmallow SDK -dontwarn org.apache.http.** # Needed when building against pre-Marshmallow SDK. -dontwarn android.security.NetworkSecurityPolicy 

And you can see the Create ProGuard exception section on this page for more details: https://developers.google.com/android/guides/setup p>

0
source

All Articles