我知道這個問題已被許多人問及已被回答。谷歌Firebase登錄狀態12501(不工作),在發佈構建變體和jks SHA
那麼,爲什麼我又問這個問題呢?因爲我嘗試了這些解決方案,並且我確實遵循了Google文檔,遵循教程和YouTube。仍然沒有運氣。
好吧,這就是我在我的項目中所做的。
項目: GoogleSignIn
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
}
搖籃(模塊:APP)
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'alias'
keyPassword 'keypass'
storeFile file('/home/reoxey/path/to/jks')
storePassword 'storepass'
}
}
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "reoxey.com.googlesignin"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
signingConfig signingConfigs.config
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.google.firebase:firebase-auth:9.8.0'
compile 'com.google.android.gms:play-services-auth:9.8.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
LoginActivity.java
gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.web_client_key))
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
findViewById(R.id.sign_in_button).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN){
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
if (result.isSuccess()){
Toast.makeText(getApplicationContext(),"Nailed it",Toast.LENGTH_LONG).show();
}else {
Snackbar.make(mLoginFormView,result.getStatus().toString(),Snackbar.LENGTH_LONG).show();
Toast.makeText(getApplicationContext(),"Messed",Toast.LENGTH_LONG).show();
}
}
}
string.xml
<string name="web_client_key">123456789-clientwebapplication.apps.googleusercontent.com</string>
清單中沒有特別的配置,我相信我不會錯過任何東西。
谷歌,services.json
{
"project_info": {
"project_number": "{numeric-id}",
"firebase_url": "https://project--123456789.firebaseio.com",
"project_id": "project--123456789",
"storage_bucket": "project--123456789.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:{numeric-id}:android:sfdjgsdkdfgsfs",
"android_client_info": {
"package_name": "reoxey.com.googlesignin"
}
},
"oauth_client": [
{
"client_id": "{numeric-id}-androidkey.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "reoxey.com.googlesignin",
"certificate_hash": "{sha1-from-jks-file}"
}
},
{
"client_id": "{numeric-id}-webapplication.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "{android-key}"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "{numeric-id}-webapplication.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
Oright,現在火力地堡控制檯。
- 套件名稱創建項目
- 從JKS產生加SHA1指紋文件
- 啓用谷歌認證的登入
就是這樣我想,希望我提供的一切,
所以我在這裏想念什麼。
當我點擊谷歌標誌,它給我一個錯誤狀態碼。我不知道這裏有什麼問題。任何人?
在此先感謝。
你有沒有建立一個調試APK,並試圖登錄呢? –
明顯,但不同的sha1指紋 – Reoxey
這是否失敗,具有相同的地位? –