Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APK signing error : Failed to read key from keystore

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

like image 525
LiangWang Avatar asked Dec 08 '13 12:12

LiangWang


3 Answers

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

On mac:

./gradlew signingReport 

On Windows:

gradlew signingReport 
like image 169
Tom Susel Avatar answered Sep 28 '22 14:09

Tom Susel


Check your keystore file for first, in you example you creating file with name my-release-key.keystore. If its correct and really present in folder Users/bournewang/Documents/Project check alias, in your example it is -alias alias_name, but in config you specified alias mike

like image 44
cooperok Avatar answered Sep 28 '22 15:09

cooperok


Most likely that your key alias does not exist for your keystore file.

This answer should fix your signing issue ;)

like image 45
Stephen Vinouze Avatar answered Sep 28 '22 13:09

Stephen Vinouze



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!