gradle - proguard errors do not reflect -dontwarn

android, gradle, proguard

Solution

In what file is your "snippet" with the `-dontwarn` flags? It doesn't look like you're ever telling your `build.gradle` file about that proguard configuration.

You have:

proguardFile getDefaultProguardFile('proguard-android-optimize.txt')

But you should also have:

proguardFile 'your_proguard_config.cfg'

so that it will use both the default android configuration and your configuration.

Problem

gradle 1.10 on linux on CLI ./gradlew clean ./gradlew assembleRelease ERROR in stdout... ``` Note: there were 2 references to unknown classes. You should check your configuration for typos. (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass) Note: there were 5 unresolved dynamic references to classes or interfaces. You should check if you need to specify additional program jars. (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass) Warning: there were 106 unresolved references to classes or interfaces. You may need to add missing library jars or update their versions. :proguardRelease FAILED :proguardRelease (Thread[main,5,main]) completed. Took 4.689 secs. FAILURE: Build failed with an exception. ``` I extend an oss package bundled with gradle for release builds ( added jackson.json but not from maven central ). For some reason, proguard is throwing hundreds of 'org.joda.time... class not found' errors despite the following snips: ``` release { runProguard true proguardFile getDefaultProguardFile('proguard-android-optimize.txt') } // in 'build.gradle' -dontwarn android.support.** -dontwarn org.joda.time.** -dontwarn org.codehaus.jackson.** -dontwarn ch.boye.httpclientandroidlib.** -dontwarn org.apache.http.** -dontwarn android.** -dontwarn java.** -dontwarn com.google.sample.castcompanionlibrary.** -dontwarn org.w3c.dom.** -dontwarn com.google.android.gms.maps.** #rcr adds -libraryjars /usr/local/src/android-sdk-linux/platforms/android-19/android.jar -libraryjars <java.home>/lib/rt.jar -libraryjars libs/jackson-core-lgpl-1.9.2.jar -libraryjars libs/jackson-mapper-lgpl-1.9.2.jar -libraryjars libs/Parse-1.1.3.jar -libraryjars libs/httpclient-1.1.jar ``` stdout DETAIL from './gradlew assembleRelease' below: ``` Initializing... Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService' Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService' Note: the configuration refers to the unknown class 'Object' Maybe you meant the fully qualified name 'java.lang.Object'? Warning: org.codehaus.jackson.map.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry Warning: org.codehaus.jackson.map.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry Warning: org.codehaus.jackson.map.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry Warning: org.codehaus.jackson.map.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry Warning: org.codehaus.jackson.map.ext.JodaDeserializers: can't find referenced class org.joda.time.DateTime Warning: org.codehaus.jackson.map.ext.JodaDeserializers: can't find referenced class org.joda.time.ReadableDateTime Warning: org.codehaus.jackson.map.ext.JodaDeserializers: can't find referenced class org.joda.time.ReadableInstant Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateTime Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateTime Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateTime Warning: org.codehaus.jackson.map.ext.JodaDeserializers$DateMidnightDeserializer: can't find referenced class org.joda.time.DateMidnight Warn ... 100s more in 'org.joda.time.**' Note: android.support.v4.text.ICUCompatIcs: can't find dynamically referenced class libcore.icu.ICU Note: com.google.android.gms.maps.internal.q: can't find dynamically referenced class com.google.android.gms.maps.internal.CreatorImplGmm6 Note: com.google.android.gms.maps.internal.q: can't find dynamically referenced class com.google.android.gms.maps.internal.CreatorImpl Note: org.codehaus.jackson.map.deser.BasicDeserializerFactory: can't find dynamically referenced class java.util.ConcurrentNavigableMap Note: org.codehaus.jackson.map.deser.BasicDeserializerFactory: can't find dynamically referenced class java.util.ConcurrentSkipListM ``` The -dontwarn proguard configs for 'org.joda.**' dont seem to work.. I have "-dontnote **ILicensingService" in config and that does not appear to work. The -dontwarn config for com.google.android.gms.** not working The -dontwarn for java.util.** not working

Original source