Google Proguard Banner

I am trying to confuse google play services banner with proguard. I tried two versions of the proguard configuration file.

  • The first one contains

    -keep class ** { public protected *; } 

And the jug is not confused. It looks ok.

  1. The second contains

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

And proguard removes everithing. I get an error message:

  Error: The output jar is empty. Did you specify the proper '-keep' options? 

Why is it empty because com.google.android.gms is the main package of Google Play services?

+1
source share
1 answer

The following ProGuard configuration shrinks the Google Play Services banner without optimizing or obfuscating, preserving only the API associated with the ads:

 -injars android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar -outjars google-play-services-ads.jar -libraryjars android-sdk/extras/android/support/v4/android-support-v4.jar -libraryjars android-sdk/platforms/android-20/android.jar -verbose -forceprocessing -dontoptimize -dontobfuscate -dontwarn com.google.**.R -dontwarn com.google.**.R$* -dontnote -keep public class com.google.ads.** { public protected *; } -keep public class com.google.android.gms.ads.** { public protected *; } -keep class com.google.android.gms.common.internal.safeparcel.SafeParcelable { java.lang.String NULL; } 

It reduces the original jar from 2819 classes to 409 classes (from 2.7M to 476K). I have not tested the result. If any remote classes are accessed by reflection, they must also be stored in the configuration.

+2
source

Source: https://habr.com/ru/post/1205269/


All Articles