Android Studio Signed APK ':app:transformClassesAndResourcesWithProguardForRelease'

10,621

Solution 1

Try performing a clean build (Build > Clean Project) and buliding again.

If that doesn't work, it's likely Proguard is removing some important classes and/or libraries in your app. Take a look at the warnings generated above the error message in the log. You'll need to add rules to your proguard-rules.pro file to keep the necessary classes. Here is an example of the rules required to keep the Butterknife library.

Solution 2

I had this error, and I don't know why it happened.

I have tried lot of solutions without success.

Except adding these lines to my ProGuard file (proguard-rules.pro) :

-ignorewarnings

-keep class * {
    public private *;
}

Then Clean and Rebuilt, then generate release apk.

Thanks to Rahul...

Share:
10,621

Related videos on Youtube

fabienbranchel
Author by

fabienbranchel

Updated on September 15, 2022

Comments

  • fabienbranchel
    fabienbranchel over 1 year

    When I try to generate signed in Android Studio, I've got the following error :

    Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. java.io.IOException: Please correct the above warnings first.

    Already make some research and find that for example :

    Error:Execution failed for task ':android:transformClassesAndResourcesWithProguardForRelease'

    I followed the advice, it didn't works. So, I tried to update my buildToolsVersion to 23.0.2.

    Didn't work too.

    It's works only when I modify minifyEnabled to false, and I don't want to.

    Can you give me a track please ?

  • Harv
    Harv over 5 years
    Thanks - after frigging around with 'version' compatibility around gradle this was actually the fix for me.
  • Nic Dahlquist
    Nic Dahlquist about 5 years
    Note that this directive will prevent proguard from removing any unused classes, which may greatly increase the size of your app. You may want to consider using a more targeted directive (for example, only keeping the package that is causing the original error).