can't generate signed APK from Android studio "Execution failed for task ':packageRelease'"

김재형 picture 김재형 · Jun 19, 2015 · Viewed 19.6k times · Source

I am using Android Studio 1.2.2 and tried to generate APK with proguard setting. But I can't do it and got below error message.

"Execution failed for task ':packageRelease'.

Unable to compute hash of /Users/Documents/projectX/app/build/intermediates/classes-proguard/release/classes.jar "

The proguard setting is just simple.

-dontshrink
-dontoptimize
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose

And the gradle file is below.

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion "Google Inc.:Google APIs:22"
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.bientus.cirque.sansotong"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
//        multiDexEnabled true
    }
    buildTypes {
        debug {
            debuggable true
        }

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

dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:22.0.0'
        compile "com.google.android.gms:play-services:7.5.0"
//    compile 'com.android.support:multidex:1.0.0'
}

buildscript {
    repositories {
//        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        classpath 'com.google.gms:google-services:1.3.0-beta1'
    }
}

Can anybody give any idea or thought? Thank you very much!

Answer

Artemiy picture Artemiy · Sep 10, 2015

Just add to the project's proguard-rules:

-keep public class com.google.android.gms.**
-dontwarn com.google.android.gms.**