Search code examples
androidandroid-6.0-marshmallowandroid-proguard

ProGuard fails when updating to Android SDK 23


I am trying to update the Umweltzone Android application to SDK 23. Therefore, I change the project configuration as follows:

// Excerpt from Umweltzone/build.gradle
compileSdkVersion 23
// ...
compile "com.android.support:design:23.1.1"

When I build a release version this fails with this error (tailing part):

...
Note: there were 3 references to unknown classes.
You should check your configuration for typos.
(http://proguard.sourceforge.net/manual /troubleshooting.html#unknownclass)

Note: there were 2 classes trying to access enclosing classes using reflection.
You should consider keeping the inner classes attributes (using '-keepattributes InnerClasses').
(http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)

Note: there were 100 unkept descriptor classes in kept class members. You should consider explicitly keeping the mentioned classes (using '-keep').
(http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)

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)

Note: there were 3 accesses to class members by means of introspection.
You should consider explicitly keeping the mentioned class members (using '-keep' or '-keepclassmembers').
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)

Warning: there were 1 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)

Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:Umweltzone:transformClassesAndResourcesWithProguardForRelease FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':Umweltzone:transformClassesAndResourcesWithProguardForRelease'.
    > java.io.IOException: Please correct the above warnings first.

The release build does work with SDK 22. The ProGuard configuration can be found here. The full build output can be found here since StackOverflow does not let me paste here because of length restrictions.


Solution

  • Stick to the error message, i.e. correct the above warnings first.

    The above warning is:

    com.google.android.gms.auth.GoogleAuthUtil: can't find referenced method
    'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,
    java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
    

    Most likely, you don't need that method. So you can get rid of the warning by adding the below line to the proguard config:

    -dontwarn com.google.android.gms.**