您指定的签名指纹已被另一个 Android OAuth2 客户端使用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24160011/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 07:51:18  来源:igfitidea点击:

The signing fingerprint you specified is already used by another Android OAuth2 client

androidgoogle-apigoogle-plusgoogle-oauthoauth2client

提问by Elena

Some time ago I created an example project (lets call it "example project") with Oauth2 client idfor android application in Google APIs console. I also added SHA1 fingerprintand package name (for example com.package.name).

前段时间我Oauth2 client id在 Google API 控制台中创建了一个示例项目(我们称之为“示例项目”),用于 android 应用程序。我还添加了SHA1 fingerprint包名(例如 com.package.name)。

My mistake was that an application with same package name already existed. Now I need to create an Oauth2 client idfor android application in the "valid project" with package name com.package.nameand with SHA1 fingerprintwhich I added before. Obviously when I tried to add this fingerprint I got an error.

我的错误是已经存在具有相同包名的应用程序。现在我需要Oauth2 client id在“有效项目”中创建一个for android 应用程序com.package.nameSHA1 fingerprint其中包含我之前添加的包名称。显然,当我尝试添加此指纹时,出现错误。

The signing fingerprint you specified is already used by another Android OAuth2 client.

After that I remembered about "example project" and deleted client idfrom this project. The problem is that I still not able to add this fingerprint for package name com.package.name. Client idis deleted but still I have the same error as above.

之后我想起了“示例项目”并client id从这个项目中删除。问题是我仍然无法为包名添加此指纹com.package.nameClient id已删除,但我仍然有与上述相同的错误。

So do I have a possibility to use this fingerprint for the same package name in another project?

那么我是否有可能在另一个项目中将此指纹用于相同的包名称?

采纳答案by surfer190

This error occurs when there is an existing SIGNING CERTIFICATE FINGERPRINT (SHA1)on Google Developers linked to a different account.

SIGNING CERTIFICATE FINGERPRINT (SHA1)Google Developers 上的现有帐户链接到其他帐户时,会发生此错误。

Solution is to delete the project that is using that SHA1in console.developers.google.comfor the old/incorrect project.

解决办法是删除使用该项目SHA1console.developers.google.com旧/不正确的项目。

You cannot change the SHA1 fingerprint once it is set. Remember that deleting the project takes 7 days to completely remove it.

SHA1 指纹一旦设置就无法更改。请记住,删除项目需要 7 天才能完全删除它。

Another option is to delete the debug.keystoreand generate a new one with:

另一种选择是删除debug.keystore并生成一个新的:

keytool -genkey -v -keystore debug.keystore -alias androiddebugkey
-storepass android -keypass android -keyalg RSA -validity 14000

Remember you have to uninstall the app otherwise you get the [INSTALL_FAILED_UPDATE_INCOMPATIBLE]error.

请记住,您必须卸载该应用程序,否则会出现[INSTALL_FAILED_UPDATE_INCOMPATIBLE]错误。

回答by thanhbinh84

If you are using each firebase project for each env as I am, the below approach might be helpful.

如果您像我一样为每个环境使用每个 firebase 项目,下面的方法可能会有所帮助。

In your build gradle, create new application id for each env:

在您的构建 gradle 中,为每个 env 创建新的应用程序 ID:

productFlavors {
        dev {
            applicationId "se.abc.dev"
        }
        stag {
            applicationId "se.abc.stag"
        }
        prod
    }

On each firebase project, add a new project with corresponding application id with the same finger print. Remember to download the new google service json file since the application id was changed. The package name remains the same so it would not be a problem when uploading into google play. But for sure, I leave the prod flavor empty, so the package name and application id will be the same for prod release to avoid trouble.

在每个 firebase 项目上,添加一个具有相同指纹的相应应用程序 ID 的新项目。由于应用程序 id 已更改,请记住下载新的 google 服务 json 文件。包名保持不变,所以上传到google play时不会有问题。但可以肯定的是,我将 prod 风味留空,因此 prod 版本的包名称和应用程序 ID 将相同以避免麻烦。

回答by shadowsheep

As someone could wanna use the same application through two or more firebase projects for many reasons and so get this error I here do address this particular scenario. The esiest way to run the same application upon two or more different firebase projects (let's say production and staging) is to add to your Module level build.gradlefile a build variant (let's say staging) like this one:

由于许多原因,有人可能希望通过两个或多个 firebase 项目使用相同的应用程序,因此遇到此错误,我在这里确实解决了这个特定场景。在两个或多个不同的 firebase 项目(假设生产和暂存)上运行相同应用程序的最简单方法是将build.gradle构建变体(假设暂存)添加到您的模块级文件中,如下所示:

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "com.mydomain.myapp"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 18
        versionName "2.8"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        staging {
            initWith debug
            applicationIdSuffix ".staging"
            versionNameSuffix = "-staging"
        }
    }
}

dependencies {
    [...]
}

// Firebase
apply plugin: 'com.google.gms.google-services'

In the build variant stagingwhat's most important is the line:

在构建变体中staging,最重要的是以下行:

applicationIdSuffix ".staging"

This will inject at build time a ".staging" suffix to your application ID so that you will automatically have

这将在构建时为您的应用程序 ID 注入一个“.staging”后缀,以便您自动拥有

applicationId "com.mydomain.myapp.staging"

You than need to add this application ("com.mydomain.myapp.staging") to your firebase staging project and so you will be able to add the same "com.mydomain.myapp"SHA1to this application, because it has a different application ID.

您需要将此应用程序 ( "com.mydomain.myapp.staging")添加到您的 firebase 暂存项目,因此您将能够向此应用程序添加相同的"com.mydomain.myapp"SHA1,因为它具有不同的应用程序 ID。

回答by Jorgesys

The signing fingerprint you specified is already used by another Android OAuth2 client

您指定的签名指纹已被另一个 Android OAuth2 客户端使用

I have to check every project and tried to find another Client ID configured with the SHA1 fingerprint and package name that i tried to configure, unsuccesfully.

我必须检查每个项目,并试图找到另一个使用我尝试配置的 SHA1 指纹和包名称配置的客户端 ID,但未成功。

At the end the solution was delete the client ID that i tried to edit and add again with the SHA1 fingerprint and package name, it worked for me.

最后,解决方案是删除我尝试编辑的客户端 ID,并使用 SHA1 指纹和包名称再次添加,它对我有用。

enter image description here

在此处输入图片说明

回答by Aditya

Ran into this issue today. As the project takes a long time to get completely deleted, the easiest way is to create a new SHA1 by simply deleting the local debug.keystore. It get's auto generated when you run any app after deleting it. This is documented in the Android docs here.

今天遇到这个问题。由于项目需要很长时间才能完全删除,最简单的方法是通过简单地删除本地debug.keystore来创建新的 SHA1 。当您删除任何应用程序后运行它时,它会自动生成。这在此处的 Android 文档中进行了记录

回答by Brian

I'll note that this if your app is listed in the play store, you probably don't want to change the package name and you probably don't want to replace the production key (as you'll be forced to make a new listing).

我会注意到,如果您的应用程序在 Play 商店中列出,您可能不想更改包名称并且您可能不想替换生产密钥(因为您将被迫创建一个新的清单)。

If you're absolutely sure that there are no currently active projects making use of the current package-name/fingerprint pair, one final thing to try: Make a completely new credential.You'll have to replace your credential file in the application.

如果您绝对确定当前没有使用当前包名/指纹对的活动项目,那么最后一件事要尝试:制作一个全新的凭证。您必须替换应用程序中的凭证文件。

I didn't expect this to help, but it did. Maybe Google is somehow caching the lookup? "This packagename/fingerprint/clientID lookup is a duplicate, so don't bother looking it up again."

我没想到这会有所帮助,但确实如此。也许谷歌以某种方式缓存了查找?“这个包名/指纹/客户端ID查找是重复的,所以不要再费心查找了。”

回答by Shahzad Afridi

It's late but worth. I have done the same mistake. I added a project to firebase in the wrong account then I deleted and try to add in another firebase account but I couldn't do it because the error indicates that the project is already registered. So it takes time to round about 5 to 7 days to completely delete.

晚了但值得。我也犯过同样的错误。我在错误的帐户中向 firebase 添加了一个项目,然后我删除并尝试添加另一个 firebase 帐户,但我无法这样做,因为该错误表明该项目已注册。所以大约需要5到7天的时间才能完全删除。

Here is the step I followed to generate another sha1.

这是我生成另一个 sha1 所遵循的步骤。

  1. Go to .android in my pc located. C:\Users\shahz.android.
  2. delete debug.keystore.
  3. rebuild android project.
  4. click on signing report (right side bar click gradle, app/task/android/siginingReport)

  5. you will get a new debug key with new sha1.

  6. register your app.

  1. 转到位于我的电脑中的 .android。C:\用户\shahz.android。
  2. 删除 debug.keystore。
  3. 重建安卓项目。
  4. 点击签名报告(右侧栏点击gradle,app/task/android/siginingReport)

  5. 您将获得一个带有新 sha1 的新调试密钥。

  6. 注册您的应用程序。

回答by Binesh Kumar

I have faced same problem, its solution is very simple

我遇到了同样的问题,它的解决方案很简单

Go to Console.developer and you can see some auto generated key created with this package. delete that package and add again sha key. hope you will got success. follow this link https://console.developers.google.com/apis/credentials?

转到 Console.developer,您可以看到一些使用此包创建的自动生成的密钥。删除该包并再次添加 sha 密钥。希望你会成功。按照此链接 https://console.developers.google.com/apis/credentials