简体   繁体   中英

Error “Status{statusCode=PLACES_API_INVALID_APP, resolution=null}” when using google places api in android

I am using google maps in my android app and map successfully loaded in my app. I initialize google map in my app with this code :

mGoogleApiClient = new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addApi(Places.GEO_DATA_API)
                .addApi(Places.PLACE_DETECTION_API)
                .addApi(LocationServices.API)
                .enableAutoManage(this, this)
                .build();

And google places api was worked for me very well, but today an error occurred when using place auto complete! this is first time that this error is occurred :

Status{statusCode=PLACES_API_INVALID_APP, resolution=null}

I using the correct api key and all of my code is correct because it worked until today. But suddenly this error occurred. Please help me :) thanks in advance

That error indicates something is wrong with you API setup - either the package name or signature is wrong. If you didn't change your code, the mostly likely thing that is wrong is you signed the app with a different key. If you --

1) Changed from debug to release mode, or

2) Are compiling on a different computer or install of AS in debug mode

Then it is likely that you have to add another SHA-1 fingerprint to your API key. Follow the instructions on getting your SHA-1 fingerprints here -- https://developers.google.com/places/android-api/signup . Check in the API console to make sure you've added all the necessary keys.

In my case the error was because I put

<meta-data
      android:name="com.google.android.geo.API_KEY"
      android:value="{MY_KEY}"/>

outside Application tag. After adding inside Application tag all began to work

如果您在生成api密钥后更改了系统,则必须在google api控制台中更新当前系统SHA密钥。

如果此处列出的所有内容都无济于事 - 请尝试在google api控制台中设置为no restrictions ,这对我有所帮助

if you have issue on publish app on Google play console.

Release mangement > app signing > App signing certificate SHA1

Your app public certificate was changed to new one.

Lets check at here first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM