Proguard Note for unknown class 'Object' with Android Studio and Gradle

android, android-studio, gradle, proguard

Solution

Thanks for the suggestion Eric Lafortune! Adding `-printconfiguration` to my proguard.txt revealed that the problem was in the google-play-services_lib (r13).

The guilty Proguard rule is (it should be `java.lang.Object[][]`):

-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

You can see this on a Mac by right clicking on `Android Studio`, do `Show Package Contents`, then browse to `sdk/extras/google/google_play_services/libproject/google-play-services_lib/proguard.txt`.

The quickest workaround is to add the correct Proguard rule into your own Proguard configuration and just ignore the Proguard Note.

-keep class * extends java.util.ListResourceBundle {
    protected java.lang.Object[][] getContents();
}

I raised this bug with Google as Android Issue #63095.

Problem

I've created a new project in Android Studio and am using Gradle to build it. I've added my Proguard integration for release builds, and I am seeing this Note every time I run my `assembleRelease` step: ``` Note: the configuration refers to the unknown class 'Object' Maybe you meant the fully qualified name 'java.lang.Object'? ``` None of my Proguard configuration files, or the ones in the Android SDK folder include an unqualified name `Object`. My `build.gradle` includes: ``` buildTypes { release { runProguard true proguardFile 'proguard-project.txt' proguardFile getDefaultProguardFile('proguard-android-optimize.txt') signingConfig signingConfigs.release } } ``` I even see the same Note when I remove both the `proguardFile` lines above, and also if I delete my custom Proguard rules (each time doing a clean before rebuilding). I'm guessing this is a benign issue with the Proguard plugin for Gradle?

Original source