Andrei Mankevich
Andrei Mankevich

Reputation: 2273

Make Proguard completely ignore package

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).

Upvotes: 3

Views: 2785

Answers (1)

Rodrigo Direito
Rodrigo Direito

Reputation: 746

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'])

Upvotes: 1

Related Questions