2016-02-29 91 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