3

Is it possible to have Proguard enabled but keep some classes completely untouched by Proguard? I have the following lines in my proguard config file:

-keep class com.heyzap.** { *; }

But as I can see classes inside Heyzap package are actually changed anyway after Proguard pass (they are different from what I originally had in Heyzap jar file).

I don't know what exactly Proguard do with Heyzap SDK but after this build process fails on converting jar file to dex format with error:

EXCEPTION FROM SIMULATION: com.android.dx.rop.cst.CstInterfaceMethodRef cannot be cast to com.android.dx.rop.cst.CstMethodRef

Also I have -dontoptimize option enabled in my config.

Heyzap recommends to use this line to keep their SDK untouched:

-libraryjars libs/heyzap-ads-sdk.jar 

But Android Studio fails to compile the project with this line added because heyzap-ads-sdk.jar is automatically added to -injars list (it throws 'The same input jar is specified twice.' error).

Andrei Mankevich
  • 2,253
  • 16
  • 15

1 Answers1

1

To make ProGuard completely ignore a package you can use:

-keepclasseswithmembers class com.my.package.** {*;}

But, the error you're getting means something else, you should try to remove -libraryjars libs/heyzap-ads-sdk.jar from your ProGuard file, because this library is probably being added somewhere else like in your build.gradle file, probably by this line:

compile fileTree(dir: 'libs', include: ['*.jar'])
Rodrigo Direito
  • 748
  • 6
  • 21
  • I tried 'keepclasseswithmembers' but my classes were still modified. Yes, sure I can't use 'libraryjars' option because the Heyzap jar is added from my build.gradle. But I need to keep proguard away from it, like it would be with 'libraryjars'. – Andrei Mankevich Jun 30 '15 at 02:40