2016-11-16 83 views
0

我正在使用Firebase和Google Signin將用戶身份驗證爲Android應用。此應用程序正在工作,但我重新安裝了Ubuntu和Android Studio。現在它不再工作了。Google登錄失敗的Firebase Android應用 - GoogleSignInResult @ a84236f

我把電子郵件地址和密碼進行身份驗證與谷歌登錄(使用電子郵件和谷歌的密碼),該錯誤返回信息 GoogleSignInResult @ a84236f 稱那返回TIS值的函數是:

onActivityResult(INT requestCode,INT resultCode爲,意圖數據)

是什麼代碼的含義是: GoogleSignInResult @ a84236f

和result.isSuccess() 的結果是:false

功能齊全是:

@Override 
    public void onActivityResult(int requestCode, int resultCode, Intent data) { 
     super.onActivityResult(requestCode, resultCode, data); 

     // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...); 
     Log.d("DEIP","request code = 9001? ="+requestCode); 
     if (requestCode == RC_SIGN_IN) { 
      GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); 
      Log.d(TAG," isSucess? result.toString ="+result.toString()); 
      Log.d(TAG," +result.isSuccess() ="+result.isSuccess()); 
      if (result.isSuccess()) { 
       // Google Sign In was successful, authenticate with Firebase 
       GoogleSignInAccount account = result.getSignInAccount(); 
       firebaseAuthWithGoogle(account); 
      } else { 
       // Google Sign In failed 
       Log.e(TAG, "Google Sign In failed."); 
       Log.d(TAG,"Failed into onActivityResult"); 
      } 
     } 
    } 

失敗後的結果:

isSucess? result.toString = com.google.android.gms.auth.api.signin**[email protected]**:+ result.isSuccess()= false

另一件事,我用指令keytool -exportcert -list -v -alias androiddebugkey -keystore〜/ .android/debug.keystore

給了我一個SHA1指紋,但是當我把這個值到火力地堡控制檯指紋時,firebase.console.google.com網站識別爲SHA256指紋。

可能是這個問題與上面的問題有關?我該如何解決它?

我想:

  1. 重新生成SHA1指紋。 - Firebase向我提供的信息是我的sh1指紋是256指紋。我也生成了釋放鍵和調試鍵。

  2. 我將新文件google-services.json放到Android Studio的應用程序目錄中。

  3. 我試圖運行應用程序到一個物理手機,但錯誤是一樣的虛擬手機。

  4. 將包名稱與文件AndroidManifes.xml以及該字段比較到Firebase控制檯中。

  5. 清理項目並重建。

  6. 禁用即時運行

  7. 我把依賴(9.8的新值。0)喜歡編譯'com.google.firebase:firebase-auth:9.8.0'

    依賴性{ 編譯文件樹(DIR: '庫',包括:[ '的* .jar']) testCompile '的junit:junit的:4.12'

    compile 'com.android.support:design:24.0.0' 
    compile 'com.github.bumptech.glide:glide:3.6.1' 
    compile 'de.hdodenhof:circleimageview:1.3.0' 
    compile 'com.android.support:appcompat-v7:24.0.0' 
    
    // Google 
    compile 'com.google.android.gms:play-services-auth:9.8.0' 
    
    // Firebase 
    compile 'com.google.firebase:firebase-database:9.8.0' 
    compile 'com.google.firebase:firebase-auth:9.8.0' 
    compile 'com.google.firebase:firebase-config:9.8.0' 
    compile 'com.google.android.gms:play-services-appinvite:9.8.0' 
    compile 'com.google.firebase:firebase-messaging:9.8.0' 
    compile 'com.google.android.gms:play-services-ads:9.8.0' 
    compile 'com.google.firebase:firebase-crash:9.8.0' 
    compile 'com.google.firebase:firebase-analytics:9.8.0' 
    // Firebase UI 
    compile 'com.firebaseui:firebase-ui-database:0.4.0' 
    
    // Testing dependencies 
    androidTestCompile 'junit:junit:4.12' 
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' 
    androidTestCompile 'com.android.support.test:runner:0.5' 
    androidTestCompile 'com.android.support:support-annotations:24.0.0' 
    compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3' 
    
    //tryning to make COntrainlayout work 
        //compile 'android.support.constraint.ConstraintLayout' 
    // 
    
    compile 'com.google.firebase:firebase-core:9.8.0' 
    

    }

    應用插件: 'com.google.gms.google服務' 應用插件: 'com.android.application'

回答

0

錯誤是我創建指紋的方式。 該命令

keytool -exportcert -list -v \ 
-alias androiddebugkey -keystore ~/.android/debug.keystore 

沒有工作給我。 創建調試指紋的方式是: 「 」[基本上,在Android Studio中,打開最右邊的Gradle菜單,從下拉菜單中打開android-start(如果沒有顯示則刷新),打開任務,打開android ,雙擊signingReport在這個環節上出 : https://github.com/firebase/friendlychat/issues/11

或本視頻教程 [https://www.youtube.com/watch?v=m_9tk7ME4ZU][2]

的火力地堡的團隊幫助我這個錯誤。

0

我有同樣的問題,我想this tutorial

它說,在這個步驟,是解決此問題:

  1. 與釋放密鑰存儲的SHA1更新火力地堡控制檯。
  2. 重新下載google-config.json文件。
  3. 將您的發行版keystore放置在您的gradle文件所在的文件夾中,並使用下面的代碼更新gradle。