Error "Status{statusCode=PLACES_API_INVALID_APP, resolution=null}" when using google places api in android
Asked Answered
P

5

5

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

Pellegrini answered 30/11, 2016 at 15:40 Comment(0)
S
4

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.

Spikelet answered 30/11, 2016 at 18:36 Comment(1)
Thanks. your idea worked for me. My problem was that i changed my os and start developing my signed app in new os. So after you help me i useed keytool and signing again in developer console.And now my problem solvedPellegrini
M
2

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

Melodramatize answered 16/4, 2018 at 15:47 Comment(0)
K
1

If you have changed your system after generating the api key then you have to update the current system SHA key in the google api console.

Krystakrystal answered 2/11, 2017 at 10:31 Comment(0)
M
1

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.

Mangonel answered 20/6, 2019 at 7:27 Comment(0)
L
0

If all that is listed here does not help - try set to no restrictions in google api console, it helped me

Lieselotteliestal answered 10/7, 2018 at 15:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.