APK signing error : Failed to read key from keystore

LiangWang picture LiangWang · Dec 8, 2013 · Viewed 109.7k times · Source

I'm developing android app under intellij and gradle. and using following way to generate keystore file:

keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

then used the keystore file in build.gradle:

signingConfigs {
    robert {
        storePassword 'robert'
        storeFile file('/Users/bournewang/Documents/Project/android.keystore')
        keyPassword 'robert'
        keyAlias 'mike'
    }
}

when finally trying to generate signed apk file: ./gradlew assembleRelease

it gives the error:

Execution failed for task ':Myexample:packageRelease'.

Failed to read key from keystore

Answer

Tom Susel picture Tom Susel · Mar 9, 2014

In order to find out what's wrong you can use gradle's signingReport command.

On mac:

./gradlew signingReport

On Windows:

gradlew signingReport