Google PlacePicker Closes Immediately After Launch with resultCode 2

前端 未结 3 1975
故里飘歌
故里飘歌 2021-01-06 00:34

In my project PlacePicker was working fine but today suddenly its closing immediately after launch with resultCode 2.

here is the logcat output

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-06 01:04

    Assuming you have the Place API for Android enabled and your API key is correctly configured in your manifest, this could also happen if you are missing your SHA-1 certificate fingerprint(s) in your developer console. So, make sure you have the following covered:

    1. In the developers console make sure you have the API key generated for your android app and make sure the API key is entered in your manifest file. It should be a meta tag nested inside the application tag.

      
          
              
              ... other stuff
          
      
      
    2. On the same page as your API key, at the bottom, you need to enter the package name from your manifest and the certificates. While in development/debug mode you can use the certificate from the debug keystore supplied by the studio, however, for the release version you'd have to generate your own keystore.

    To generate the keyhash for the debug mode:

    keytool -exportcert -alias androiddebugkey -keystore C:\Users\{username}\.android\debug.keystore -list -v
    

    Same command is used for the release version, but this time you'd need to point to your own keystore.

    More info here

提交回复
热议问题