2016-02-29 51 views
-1

我試圖讓Android Developers的Getting the Last Known Location tutorial正常工作,並且遇到困難時期。如何讓Google Play服務的定位服務起作用?

如果我按照如上鍊接的教程,一切正常,直到我運行應用程序,此時我的錯誤:

02-29 15:25:00.542 14116-14116/local.test.t1 E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.

谷歌搜索這一點,我發現我需要以某種方式與谷歌進行註冊(但在Google教程的任何地方都沒有提及)。

我最終在Accessing Google APIs結束了,從谷歌的單獨教程,它說:

Note: Before making calls to specific Google services, you may first need to register your app in the Google Developer Console. For instructions, refer to the appropriate getting started guide for the API you're using, such as Google Drive or Google Sign-In.

但對如果我只想使用定位服務的具體信息。我無論如何去了那裏,發現我需要得到一個配置文件,我需要生成一個SHA-1,然後我指向this link生成它,在這一點上,我現在難倒了。它說:

To get the release certificate fingerprint: 

keytool -exportcert -list -v \ 
-alias <your-key-name> -keystore <path-to-production-keystore> 

這是什麼path-to-production-keystore我應該指向?它沒有提供進一步的信息。它確實給出了調試指紋的實際命令,但表示我應該同時發佈和調試。

有人可以告訴我,如果我走錯了兔子洞,或者如果它是正確的,下一步是什麼?

+0

你不應該需要那些爲融合的位置提供商。我沒有[這些項目中的任何一個](https://github.com/commonsguy/cw-omnibus/tree/master/Location),並且他們在幾個月前工作得很好。我甚至用'play-services-location'的'8.4.0'試了一下,該應用沒有任何問題。 – CommonsWare

回答

0

我在使Google Play服務運行時遇到了很大的麻煩。 考慮到你使用Android Studio中,您可以試試這個得到SHA1鍵:

  1. 打開Android工作室
  2. 在右側按:搖籃
  3. 前往任務 - > Android的
  4. 雙擊signingReport

你會看到在底部「Run'-Tab鍵

發現...你的代碼ERE:SHA-1 fingerprint of keystore certificate