Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Signed APK ':app:transformClassesAndResourcesWithProguardForRelease'

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 ?

like image 643
fabienbranchel Avatar asked Mar 14 '16 18:03

fabienbranchel


People also ask

How do I generate an app signing key using Android Studio?

If you don't already have an app signing or upload key, you can generate one using Android Studio as follows: In the menu bar, click Build > Build > Generate Signed Bundle/APK. In the Generate Signed Bundle or APK dialog, select Android App Bundle or APK and click Next. Below the field for Key store path, click Create new.

How do I generate a signed APK file?

To generate a signed APK file, open the Build menu from the toolbar and select Generate Signed Bundle/APK. This opens up a screen where you have to select between creating an Android App Bundle and creating an APK file.

How to generate signed bundle or APK for Android?

Step 1: Go to Build -> Generate Signed Bundle or APK, a pop up will arise. Choose APK in the pop-up and click on Next. Step 2: After completing step 1, if you already have a key, make sure you just refer to that and you can release the version of that app but in case if it is the first time it is recommended to create a new key.

What is a signing configuration in Android Studio?

A signing configuration consists of a keystore location, keystore password, key alias, and key password. To create a signing configuration and assign it to your release build type using Android Studio, complete the following steps: In the Project window, right click on your app and click Open Module Settings .


2 Answers

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

like image 78
Christian Avatar answered Oct 03 '22 16:10

Christian


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.

like image 39
Colin White Avatar answered Oct 03 '22 16:10

Colin White