Google Awareness API, Invalid API key, Crash

前端 未结 5 2018
轮回少年
轮回少年 2021-01-18 21:15

This is my first attempt at creating an android application. In trying to use the Awareness API provided by Google I receive a SecurityException in logcat, and the error:

相关标签:
5条回答
  • 2021-01-18 21:27

    If you get this error in the Pre-launch reports in the Google Play Console, check "Opt-out of generating pre-launch reports where X is re-signed" in the Pre-launch settings.

    0 讨论(0)
  • 2021-01-18 21:35

    It seems like your API_KEY is set up incorrectly in the AndroidManifest: note that the right package name is

    "com.google.android.awareness.API_KEY"

    and not

    "com.google.awareness.API_KEY"

    as you seem to have it. See https://developers.google.com/awareness/android-api/get-started

    0 讨论(0)
  • In my case issue is resolved by adding following meta data tag in manifests.xml file

    <meta-data
                android:name="com.google.android.awareness.API_KEY"
                android:value="API_KEY"/>
    

    And there must exist the following tag as well

    <meta-data
                android:name="com.google.android.geo.API_KEY"
                android:value="API_KEY" />
    
    0 讨论(0)
  • 2021-01-18 21:43

    If someone facing similar issue with correct manifest declaration as mentioned in Google here can try generating API key on Google Developer Console using debug keystore for testing purpose and replacing same with release keystore while going to production.

    How generate API key? Please check out Google's word itself Here

    Hope it will help someone in future.

    0 讨论(0)
  • 2021-01-18 21:46

    Print this to the console: (new Status(403)).getStatusMessage(). It should show status message of the error. Read more here

    0 讨论(0)
提交回复
热议问题