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

巧了我就是萌 提交于 2019-12-17 04:06:12

问题


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

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

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

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

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


回答1:


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

Solution is to delete the project that is using that SHA1 in console.developers.google.com for the old/incorrect project.

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

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

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.




回答2:


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

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

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.




回答3:


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.gradle file a build variant (let's say staging) like this one:

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 staging what's most important is the line:

applicationIdSuffix ".staging"

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

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" SHA1 to this application, because it has a different application ID.




回答4:


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

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.

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.




回答5:


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.




回答6:


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).

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."




回答7:


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.

Here is the step I followed to generate another 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.



来源:https://stackoverflow.com/questions/24160011/the-signing-fingerprint-you-specified-is-already-used-by-another-android-oauth2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!