如何将调试版本中的 SHA1 值设置为与发布版本相同?

How can I set the SHA1 value in my debug build to be the same as the release build?

我正在使用 Android Studio 构建一个 android 应用程序,它将连接到 Google Play API。当我 运行 通过模拟器时,我收到消息 "The application is incorrectly configured. Check that the package name and signing certificate match the client ID created in Developer Console. Also, if the application is not yet published, check that the account you are trying to sign in with is listed as a tester account".

我认为问题在于签名证书不匹配。为了让 SHA1 值进入开发者控制台,我构建了一个 release .apk,将其解压缩并检查其上的值并将其复制到开发者控制台。 然而,我注意到的是,如果我解压调试 apk 并执行相同的操作,则值会有所不同。显然这意味着它会在模拟器中连接失败。

如果我点击“构建”>“生成签名的 APK”,我可以根据我的密钥进行签名,我怎样才能让我的调试版本也发生这种情况?

根据@tripleee 的评论,这不是解决此问题的正确方法。

您似乎应该有 2 个链接的应用程序与您在开发者控制台上的应用程序 - 一个用于您的发布应用程序,一个用于您的调试应用程序,每个应用程序都具有适当的 SHA1 值。