I am trying to use ProGuard with one of my applications, say A. This application includes another application as a library (say, B). This is my proguard file.
-optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider -keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class com.android.vending.licensing.ILicensingService -keepclasseswithmembernames class * { native <methods>; } -keepclasseswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclasseswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); } -keepclassmembers class * extends android.app.Activity { public void *(android.view.View); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } -injars bin/classes -libraryjars lib
When I first executed it, I got the following error:
Proguard returned with error code 1. See console [2012-01-05 12:18:55 - BSabadellHC-Entrega] Note: there were 1059 duplicate class definitions. [2012-01-05 12:18:55 - BSabadellHC-Entrega] java.io.IOException: Can't write [/private/var/folders/19/321lw_654pzdqr8y34ysvsx80000gn/T/android_7971378611269030364.jar] (Can't read [/private/var/folders/19/321lw_654pzdqr8y34ysvsx80000gn/T/android_1457478862713006376.jar] (Duplicate zip entry [com/ideaknowing/labs/android/ikarengine/e.class == android_1457478862713006376.jar:com/ideaknowing/labs/android/ikarengine/R$anim.class]))
The following parts are important to me:
- There are duplicate objects
- They must because of the R. files. On the console they say that there are duplicate resources in R $ (of course, since application A and library B include animations, layouts, etc.).
So, my idea was to exclude ProGuard R files, and for this I included the following lines of code:
-keep public class net.firsrproject.android.R -keep public class com.ideaknowing.labs.android.ikarengine.R
However, I still get the same error (so I think the files are still included in Proguard). Does anyone encounter deleting R files from ProGuard? Is there a hint or suggestion on how I can get rid of this error?
Thank you and welcome
source share