Enamul Haque Enamul Haque -3 years ago 102
Android Question

Generate Signin APK showing err in Android Studio

I have converted a Android Project from eclipse IDE to Android Studio IDE. I used progurard in eclipse without any err but after converting the project to android studio it showing err. When I try to Generate Sign in apk for build release apk then showing err like bellow..

Error:Execution failed for task ':calApps:transformClassesAndResourcesWithProguardForRelease'.

java.io.IOException: Please correct the above warnings first.

My progurard-project.txt is like this

-dontwarn android.support.**
-keep public class * extends android.app.Activity

My build.gradle file like this

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
// buildToolsVersion '19.1.0'
useLibrary 'org.apache.http.legacy'
compileOptions.encoding = 'ISO-8859-1'

defaultConfig {
applicationId "com.packagename.apps"
minSdkVersion 15
targetSdkVersion 17
multiDexEnabled true

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


dexOptions {
javaMaxHeapSize "4g"


dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.0'
compile project(':viewPagerIndicatorLibrary')
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
//compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.google.android.gms:play-services-maps:9.2.0'
compile 'com.android.support:multidex:1.0.0'


Please help.... Thanks in advance...

Answer Source

I found this bug happens when the versions of SDK, Build Tools and Gradle Plugins doesn't match (in terms of compatibility).

[The solutions is to verify if we using the latest versions of them]

The gradle plugins are placed in the build.gradle(Project:projectName) file of the project.

Other versions are in the build.gradle(Module:app) file of the module.

For example, for SDK 23, you must use the Build Tools 23.0.1 and gradle plugins version 1.3.1.

I change gradle plugins version then clean the project after changing settings to solve my problem.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download