11

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 ?

1
  • You're probably being asked to build with --debug or something to get more info. What does that reveal? Mar 14, 2016 at 19:40

4 Answers 4

12

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.

1
  • 3
    Fault to JodaTime. Just had this : -dontwarn org.joda.time.** to my proguard-rules.pro file, it's works. Thank you really really much Colin, drinks on me ;-) Mar 14, 2016 at 19:55
1

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...

2
  • Thanks - after frigging around with 'version' compatibility around gradle this was actually the fix for me.
    – Harv
    Jan 11, 2019 at 11:31
  • 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). Apr 28, 2019 at 4:47
0

Add this line in proguard-rules.pro

-keepattributes EnclosingMethod
0

Update your Gradle plugin and it will work.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.