4

It's so strange, I have created a keystore using android studio before. And my studio is canary channel(1.4), I always keep studio updated. Last day I get that error, I even downgraded my studio to the stable channel(1.3). But when I build using gradle in command line, everything is fine. I am sure my password is right.

Full error is :

Error:Execution failed for task ':app:packageDevRelease'.

Failed to read key ** from store "D:\work\app_proj\Android\jxj\trunk\JXJ\app\szyx.keystore": Keystore was tampered with, or password was incorrect

vvv
  • 101
  • 2
  • 7
  • Have you given any special characters in your password? – Sridhar Aug 31 '15 at 02:33
  • It's just like stack0verfl0w@2015 . Studio can build before, suddenly it's broken. Event i uninstall it and do a clean install. I have no idea... – vvv Aug 31 '15 at 02:59
  • According to me , your **KeyStore** file has some error within it. – Amit Vaghela Aug 31 '15 at 04:23
  • Default password for keystore is changeit. http://stackoverflow.com/questions/16965453/keytool-certificate-import-gives-erro-message-keystore-was-tampered-with-or – Sridhar Aug 31 '15 at 05:00
  • @vvv Would you happen to be using any google play services libraries? Which ones and how? – Jon Oct 19 '15 at 15:32
  • @Jonathan727 I have not use any google play services libraries. The newest version studio( 1.4 ) still get same error – vvv Oct 21 '15 at 03:25

3 Answers3

5

I fixed it! (for me at least)

I found the issue is somehow related to the gradle plugin.

When I changed

dependencies {
    classpath 'com.android.tools.build:gradle:1.4.0-beta6'
}

to

dependencies {
    classpath 'com.android.tools.build:gradle:1.3.1'
}

in my project's build.gradle, it fixed the problem.

Just like the OP, I was able to sign builds created using the IDE's play button, but just not the ones that I created through the Generate signed APK... menu option.

After searching, I found this open issue.

Jon
  • 9,156
  • 9
  • 56
  • 73
0

Default Password for keystore is changeit and you can also refer the below results.

keytool : Certificate import gives error message - Keystore was tampered with, or password was incorrect

keytool error Keystore was tampered with, or password was incorrect

Keytool Signing Problem: Keystore was tampered with, or password was incorrect

Community
  • 1
  • 1
Sridhar
  • 668
  • 1
  • 11
  • 22
  • It's release key, not debug key . I use "keytool -list -keystore mykeyh", input password, and it can list information – vvv Aug 31 '15 at 06:12
-2

Just as the message suggest, it should be either your password incorrect, or you keystore file is has data error.

Derek Fung
  • 8,171
  • 1
  • 25
  • 28
  • It is a file, it can be corrupted, have you saved a backup? – Derek Fung Aug 31 '15 at 04:25
  • I hava a backup,but gradle can work using just same file. – vvv Aug 31 '15 at 04:27
  • Actually you can just try with creating a new keystore, if it works then you would know the error is on your keystore file or password but nothing else. – Derek Fung Aug 31 '15 at 04:28
  • I mean have you got a backup of the keystore file, if you do, just restore the backup. – Derek Fung Aug 31 '15 at 04:29
  • Yes, I have a backup,but still get same error. If I create a new release key, it can work. – vvv Aug 31 '15 at 05:48
  • Then you can be sure that it is your keystore-password pair not matching. Sorry to ask something like this, but maybe you should check your capslock. – Derek Fung Aug 31 '15 at 06:16
  • Thanks for your patience, I event input my password in texteditor, and then copy to studio input dialog. And if I put same password in command terminal using gradle, everything is fine... – vvv Aug 31 '15 at 06:28
  • If it is the case, I think you should try reinstall a clean Android Studio, maybe something weird going on after you access the version with canary channel. Android's new changes are indeed quite broken, personally I would avoid try to avoid it until it is more stable. You should edit your original post and mention about the the success in command line but not Android Studio, it is a very important piece of information. – Derek Fung Aug 31 '15 at 06:35
  • Thanks, last day I uninstall it ,but maybe still have some profiles that not be deleted. I will search how to delete Android Studio completely ^_^ – vvv Aug 31 '15 at 06:49
  • I have the same issue with v1.4 and it's building fine with gradle from the command line. So it's definitely an issue introduced by an Android Studio update and this answer is plain wrong. – oRRs Sep 20 '15 at 11:45
  • It's *not* the keystore - I know because I keep my keystore in a git repo and git is not reporting a change in the file. Whatever code is generating the message, is wrong. Google needs to fix. – Someone Somewhere Feb 04 '16 at 12:21