logo image

Unable to build Android Application when proguard rules are enabled


I have enabled proguard rules on my Android app, Following is the configuration

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

But when I build, I am getting the following exception

Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. > Job failed, see logs for details

1 Answer

1 year ago by

I have added the following ignores, which fixed my problem.

-dontwarn java.nio.file.Files
-dontwarn java.nio.file.Path
-dontwarn java.nio.file.OpenOption
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

-keep class android.support.v7.widget.SearchView { *; }

-ignorewarnings
-keep class * {
    public private *;
}
1 year ago by Megamind