I am trying to run ProGuard on our Android app. The app builds and runs fine without ProGuard.
When I changed build.gradle to have "minifyEnabled true" I got a slew of warnings which I was able to eliminate with the following in proguard-rules.pro:
-keep class org.joda.time.** { *; }
-keep class javax.** { *; }
-dontwarn okio.**
-dontwarn javax.naming.**
-dontwarn org.joda.convert.**
-dontwarn org.bouncycastle.crypto.**
Now I get the following warnings and errors when I try to build using ProGuard (edited to add error msgs):
Warning:can't write resource [META-INF/COM_CRAS.SF] (Duplicate zip entry [crashlytics-1.1.13.jar:META-INF/COM_CRAS.SF])
Warning:can't write resource [META-INF/COM_CRAS.RSA] (Duplicate zip entry [crashlytics-1.1.13.jar:META-INF/COM_CRAS.RSA])
Warning:can't write resource [META-INF/maven/com.squareup.okhttp/okhttp/pom.properties] (Duplicate zip entry [crashlytics-1.1.13.jar:META-INF/maven/com.squareup.okhttp/okhttp/pom.properties])
Warning:can't write resource [META-INF/maven/com.squareup.okhttp/okhttp/pom.xml] (Duplicate zip entry [crashlytics-1.1.13.jar:META-INF/maven/com.squareup.okhttp/okhttp/pom.xml])
Warning:can't write resource [META-INF/maven/com.squareup/otto/pom.properties] (Duplicate zip entry [crashlytics-1.1.13.jar:META-INF/maven/com.squareup/otto/pom.properties])
Warning:can't write resource [META-INF/maven/com.squareup/otto/pom.xml] (Duplicate zip entry [crashlytics-1.1.13.jar:META-INF/maven/com.squareup/otto/pom.xml])
Warning:can't write resource [META-INF/maven/com.squareup.okhttp/okhttp-protocols/pom.properties] (Duplicate zip entry [crashlytics-1.1.13.jar:META-INF/maven/com.squareup.okhttp/okhttp-protocols/pom.properties])
Warning:can't write resource [META-INF/maven/com.squareup.okhttp/okhttp-protocols/pom.xml] (Duplicate zip entry [crashlytics-1.1.13.jar:META-INF/maven/com.squareup.okhttp/okhttp-protocols/pom.xml])
Error:org.gradle.internal.UncheckedException: java.io.IOException: Can't write [/Users/dano/workspace/COMPANY_NAME/COMPANY_NAME-android/COMPANY_NAME-android/COMPANY_NAME/app/build/intermediates/classes-proguard/COMPANY_NAMELive/release/classes.jar] (Can't read [/Users/dano/.gradle/caches/modules-2/files-2.1/com.crashlytics.android/crashlytics/1.1.13/e821eafa1bf489a26bdb71f95078c26785b37a1/crashlytics-1.1.13.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [com/a/a/ae.class == crashlytics-1.1.13.jar:com/crashlytics/android/a.class]))
Error:java.io.IOException: Can't write [/Users/dano/workspace/COMPANY_NAME/COMPANY_NAME-android/COMPANY_NAME-android/COMPANY_NAME/app/build/intermediates/classes-proguard/COMPANY_NAMELive/release/classes.jar] (Can't read [/Users/dano/.gradle/caches/modules-2/files-2.1/com.crashlytics.android/crashlytics/1.1.13/e821eafa1bf489a26bdb71f95078c26785b37a1/crashlytics-1.1.13.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [com/a/a/ae.class == crashlytics-1.1.13.jar:com/crashlytics/android/a.class]))
Error:java.io.IOException: Can't read [/Users/dano/.gradle/caches/modules-2/files-2.1/com.crashlytics.android/crashlytics/1.1.13/e821eafa1bf489a26bdb71f95078c26785b37a1/crashlytics-1.1.13.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [com/a/a/ae.class == crashlytics-1.1.13.jar:com/crashlytics/android/a.class])
Error:java.io.IOException: Duplicate zip entry [com/a/a/ae.class == crashlytics-1.1.13.jar:com/crashlytics/android/a.class]
I have tried the following, per several other SO queries:
In build.gradle:
packagingOptions {
exclude 'META-INF/COM_CRAS.SF'
exclude 'META-INF/COM_CRAS.RSA'
exclude 'META-INF/maven/com.squareup.okhttp/okhttp/pom.properties'
exclude 'META-INF/maven/com.squareup.okhttp/okhttp/pom.xml'
exclude 'META-INF/maven/com.squareup/otto/pom.properties'
exclude 'META-INF/maven/com.squareup/otto/pom.xml'
exclude 'META-INF/maven/com.squareup.okhttp-protocols/okhttp-protocols/pom.properties'
exclude 'META-INF/maven/com.squareup.okhttp-protocols/okhttp-protocols/pom.xml'
}
and
compile 'com.crashlytics.android:crashlytics:1.+' {
exclude group: 'com.squareup.okhttp', module: 'okhttp'
}
In proguard-rules.pro:
-keepattributes *Annotation*,Signature
and a variety of
-keep class <crashlytics | squareup | other>
-dontwarn <crashlytics | squareup | other>
I still get the same 4 errors and 8 warnings.
I am convinced this is something quite simple (and probably boneheaded) that I am doing wrong, but I have not been able to find anything that advances the build.
Any and all suggestions will be (A) tried and (B) appreciated.
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') { transitive = true; }