ProGuard: duplicate definition of library class?

If you add a proguard option -printconfiguration config.txt you’ll see proguard adds -libraryjars ‘D:\tools\android\platforms\android-23\android.jar’ -libraryjars ‘D:\tools\android\platforms\android-23\optional\org.apache.http.legacy.jar’ your duplicated classes (e.g. SslError) are presented in both android.jar and org.apache.http.legacy.jar Proguard adds second jar even if you don’t useLibrary ‘org.apache.http.legacy’ Here is an open bug describing the problem. So now we can’t do anything with the issue. … Read more

Prevent class member name obfuscation by ProGuard

If you dont want your class members to be obfuscated then use SerializedName annotation provided by Gson. For example: public class ClassMultiPoints { @SerializedName(“message”) public String message; @SerializedName(“data”) public List<ClassPoints> data; … } Moreover, make sure you do add proper proguard configuration for Gson library too. For example: ##—————Begin: proguard configuration for Gson ———- # … Read more

What’s the difference between “minifyEnabled” and “useProguard” in the Android Plugin for Gradle?

Quoting from tools.android.com: Built-in shrinker Version 2.0 of Android Plugin for Gradle ships with an experimental built-in code shrinker, which can be used instead of ProGuard. The built-in shrinker supports fast incremental runs and is meant to speed up iteration cycles. It can be enabled using the following code snippet: android { buildTypes { debug … Read more

Enabling ProGuard in Eclipse for Android

Android SDK (r20 or higher) Please check the predefined proguard.config refered in project.properties proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt More info: http://proguard.sourceforge.net/manual/examples.html#androidapplication On Gradle: buildTypes { release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’ … } } Here you can check a proguard “default” file that I keep updating: https://medium.com/code-procedure-and-rants/android-my-standard-proguard-ffeceaf65521 Android SDK (r19 or lower) You can add it … Read more

proguard hell – can’t find referenced class

org.simpleframework.xml.stream.StreamReader in your code refers to javax.xml.stream.events.XMLEvent. The latter class is part of the Java runtime (rt.jar) but not part of the Android runtime (android.jar), so ProGuard warns that something might be broken. If you’re sure that your application works anyway, you can specify -dontwarn javax.xml.stream.events.** ProGuard hell?