2017-02-18 124 views
0

目前我正在嘗試實施Google Play遊戲服務登錄我的Android應用。到目前爲止,我已經遇到了很多麻煩,但看起來我正在接近實際工作。Google Play遊戲服務 - 登錄失敗(OAUTH2:UNREGISTERED_ON_API_CONSOLE)

問題: 當我按下登錄,登錄函數返回以下錯誤:

02-18 12:31:51.122 5524-21263/? W/Auth: [GetToken] GetToken failed with status code: UNREGISTERED_ON_API_CONSOLE 
02-18 12:31:51.128 5206-5723/? E/TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: UNREGISTERED_ON_API_CONSOLE 
02-18 12:31:51.144 5206-32272/? W/GamesServiceBroker: Client connected with SDK 8487000, Services 10298230, and Games 39080030 

什麼我迄今所做的:

我試圖按照儘可能好的文檔,但要麼我做錯了什麼,或者是一團糟。我猜在某個地方,我犯了一個錯誤。

我的清單文件包括這樣:

<meta-data android:name="com.google.android.gms.games.APP_ID" 
      android:value="@string/app_id" /> 
<meta-data android:name="com.google.android.gms.version" 
      android:value="@integer/google_play_services_version"/> 

我有一個遊戲,ids.xml文件,包括在App-ID和ID對高分和成就。

我gradle這個:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 

    defaultConfig { 
     applicationId "com.duke.privatpc.quiztest" 
     minSdkVersion 16 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled true 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile project(':BaseGameUtils') 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.1.1' 
} 

這包括從入門頁面下載的BaseGameUtils。

我在Google Play開發者控制檯設置了遊戲並添加了創建的App-ID。

我總是使用我自己的密鑰庫來創建apk以及創建App-ID。有沒有必要在任何時候使用debug.keystore?

正如您在這裏看到的,SHA1是相同的,並顯示正確的APP-ID。

  1. APK SHA1
  2. Developer Console SHA1

老實說,我不知道我做錯了。我還啓動了測試並輸入了我的電子郵件地址。

此外,單擊我的登錄按鈕時絕對沒有任何反應。沒有Google Overlay彈出,我不確定這是不是已經很奇怪了?

我希望有人能幫助我,因爲我沒有發現任何可以幫助我的問題,對於像我這樣的業餘程序員來說,這有點令人沮喪。

謝謝!

+0

您可能想要按照相關的SO [post](http://stackoverflow.com/a/41012703/5995040)中的步驟操作。請檢查您是否按照相關文章中的建議正確設置了設置。希望這可以幫助。 –

回答

0

您是在哪裏爲您的應用創建OAuth 2.0客戶端的?從您的屏幕截圖看來,這是Google API console中的條目。

您是否還在Google Play Developer console的遊戲服務部分創建了一個條目(請參閱Google documentation中的第2步)?我在當前的遊戲中遇到了很大問題,因爲我在Google API console中手動創建了OAuth 2.0客戶端,而兩個控制檯中的Google Play Developer consoleOAuth 2.0 ID都不匹配。根據videoGoogle DevelopersOAuth 2.0客戶端只能在Google Play Developer console創建。我在這post寫了更多關於我做錯了什麼。