为什么AndroidStudio在为Google Play构建签名的APK时会失败(说错误的密码,但是我已确认的密码)?

发布于 2025-01-27 09:40:42 字数 2403 浏览 2 评论 0 原文

我有一个密钥库(.jks),我用来签署用于Google Play的应用程序(.APK)的上一版。那是一年前左右。

现在,当我尝试构建和使用密钥库时,Android Studio给我以下错误错误: 无法构建签名的APK。钥匙店被篡改,或密码不正确。

Android Studio version information: 
Android Studio Bumblebee | 2021.1.1 Patch 3
Build #AI-211.7628.21.2111.8309675, built on March 16, 2022
Runtime version: 11.0.11+0-b60-7590822 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.11.0-49-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin (211-1.6.21-release-334-AS7442.40)
Current Desktop: ubuntu:GNOME

这是我试图运行的功能:

build =>生成签名的捆绑包 / apk 显示以下屏幕...

”步骤1-构建签名apk“

”步骤2-构建签名的APK“

当我单击[完成]按钮时,Android Studio尝试构建&它因错误而失败:

无法构建签名的APK。密钥店被篡改,或密码不正确。

这是一个不正确的错误

,这是不正确的,因为我使用密码管理器存储密码,所以我知道我有正确的密码。我还保留了上次运行此功能的屏幕截图,以便可以确认关键别名,并且也是正确的。

我尝试的事情

  1. 我尝试重建几次&有错误。
  2. 我关闭&重新启动Android Studio&仍然有错误。

在某一时刻,Android Studio坠毁了Bug Report&我再次尝试了&它再次失败。

为什么发生此错误?

我发现了其他一些人报告包含特殊字符(@!等)的密码似乎是一个问题=“ nofollow noreferrer”>在此链接上。

它似乎确实是相同的失败,但我终于使它起作用&我会发布答案。

其他信息 - Android Studio 09/2023

现在,我正在运行最新版本的Android Studio,并在1年零4个月后发布此更新,因为我仍然看到Android Studio告诉我我的密码的问题是不正确的 - 甚至认为不是。

请记住我的密码来自密码管理器,我将其粘贴到 - 没有打字错误或密码错误。

分辨率 每当我尝试构建签名的APK并收到错误时,我只需重新启动Android Studio并再次构建签名的APK,粘贴在相同的密码中,然后成功。

Android Studio版本信息

Android Studio Giraffe | 2022.3.1 Patch 1
Build #AI-223.8836.35.2231.10671973, built on August 17, 2023
Runtime version: 17.0.6+0-17.0.6b829.9-10027231 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.2.0-32-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Registry:
    external.system.auto.import.disabled=true
    ide.text.editor.with.preview.show.floating.toolbar=false

当前桌面:ubuntu:gnome

I have a Keystore (.jks) which I used to sign the previous release of my App (.APK) for Google Play. That was 1 year ago or so.

Now, when I attempt to build and use my keystore, Android Studio gives me the following incorrect error:
Could not build signed APK. Keystore was tampered with, or password was incorrect.

Android Studio version information: 
Android Studio Bumblebee | 2021.1.1 Patch 3
Build #AI-211.7628.21.2111.8309675, built on March 16, 2022
Runtime version: 11.0.11+0-b60-7590822 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.11.0-49-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin (211-1.6.21-release-334-AS7442.40)
Current Desktop: ubuntu:GNOME

Here is the functionality I'm attempting to run:

Build => Generate Signed Bundle / APK
Displays the following screens...

step 1 - build signed apk

step 2 - build signed apk

When I click [Finish] button Android Studio attempts to build & it fails with the error:

Could not build signed APK. Keystore was tampered with, or password was incorrect.

That Is an Incorrect Error

However, that is not correct because I use a password manager to store the password, so I know I have the correct password. I also kept screenshots of the last time I ran this functionality so I could confirm the key alias and it is correct also.

Things I Tried

  1. I tried rebuilding a couple of times & got the error.
  2. I closed & restarted Android Studio & still got the error.

At one point Android Studio crashed with a bug report & I tried again & it failed again.

Why does this error occur?

I discovered some other people reporting what seemed to be an issue with having a password that contained special chars (@ !, etc) at this link.

It does seem to be the same failure, but I finally got it to work & I will post the answer.

Additional Information - Android Studio 09/2023

I'm now running the latest version of Android Studio and posting this update 1 year and 4 months later because I still see the problem where Android Studio tells me that my password is incorrect -- even thought it isn't.

Keep in mind my password for this comes from a password manager and I paste it in -- no typing mistakes or password mistakes.

The Resolution
Whenever I attempt to build a signed APK and I get the error, then I simply restart Android Studio and build the signed APK again, paste in the same password and it succeeds.

Android Studio Version Information

Android Studio Giraffe | 2022.3.1 Patch 1
Build #AI-223.8836.35.2231.10671973, built on August 17, 2023
Runtime version: 17.0.6+0-17.0.6b829.9-10027231 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.2.0-32-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Registry:
    external.system.auto.import.disabled=true
    ide.text.editor.with.preview.show.floating.toolbar=false

Current Desktop: ubuntu:GNOME

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

和我恋爱吧 2025-02-03 09:40:42

我有同样的问题。在我的情况下,它是 isDebuggable = true in Build.gradle(buildTypes)

I have had same problem. In my case it was isDebuggable = true in build.gradle (buildTypes)

π浅易 2025-02-03 09:40:42

我启动了一个控制台窗口,并对我的密钥库进行了以下操作。

$ keytool -list-keystore'fakenmae.jks'-storepass fake-password-same-same-one-on-i-inded in android-studio

我看到了在控制台中打印出的键盘的详细信息:

密钥库类型:JKS钥匙店提供商:Sun

您的密钥库包含1个条目

假苹果名,2019年12月15日,私人按键,证书
指纹(SHA-256):63:D3:69:69:39:29:5D:5E:14:20:E1:F6:FA:FA:FA:DF:ED
(假数据)

警告:JKS Keystore使用专有格式。建议使用
迁移到PKCS12,这是一种使用的行业标准格式
“ Keytool -ImportKeystore -srckeystore fakename.jks -destKeystore
fakename.jks -destStoreType PKCS12“。

由于我必须提供密码,因此确认我确实使用了正确的密码。

它还确认了密钥库没有被篡改(损坏)。

此时我有点困惑。

<<<<<<<<<<<<<<<<<<<<<<< strong>

我再次尝试了AndroidStudio,并构建了签名的APK

。 的信息。

Android Studio很想听到某人知道为什么

I started a console window and ran the following against my keystore.

$ keytool -list -keystore 'fakeNmae.jks' -storepass fake-password-same-one-i-used-in-android-studio

I saw the details of my keystore printed out in the console:

Keystore type: JKS Keystore provider: SUN

Your keystore contains 1 entry

fake-alias-name, Dec 15, 2019, PrivateKeyEntry, Certificate
fingerprint (SHA-256): 63:D3:69:69:39:29:5D:5E:14:20:E1:F6:FA:DF:ED
(fake data)

Warning: The JKS keystore uses a proprietary format. It is recommended
to migrate to PKCS12 which is an industry standard format using
"keytool -importkeystore -srckeystore fakeName.jks -destkeystore
fakeName.jks -deststoretype pkcs12".

Since I had to supply my password this confirmed that I was indeed using the correct password.

It also confirms that the keystore was not tampered with (corrupted).

I was a bit confused at this point.

Solution

I started AndroidStudio again & tried it again and it built the signed APK with no problem. I was able to upload it to Google Play.

Very odd. It seems that listing the details somehow fixed the issue in Android Studio. Would love to hear something about this from someone who might know why.

Maybe it has to do with that new warning about the PKCS12 format??

筑梦 2025-02-03 09:40:42

就我而言,这是错误的别名,在创建密钥库期间指定别名,因此,如果别名与创建过程中指定的别名不同,则确定会出现错误。

In my case it was the wrong alias, alias is specified during the creation of the keystore, so if the alias is not the same as the one specified during creation you definite get an error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文