8

I am trying Google Place Autocomplete Example from https://github.com/googlesamples/android-play-places.

I have put the correct API key at the correct place. I knew it because when I put a random string invalid API key I will get a different error.

So after I put the correct API key, I run the app in both real device and simulator. Both devices gave me this error:

Status{statusCode=PLACES_API_INVALID_APP, resolution=null}

What causes this error and how to fix it?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Aldian Fazrihady
  • 141
  • 1
  • 1
  • 6
  • The documentation [here](https://developers.google.com/android/reference/com/google/android/gms/location/places/PlacesStatusCodes.html#INVALID_APP) should help answer your question. – Daniel Resnick Oct 14 '15 at 05:16
  • Thank you Daniel. I am sure this is the same as INVALID_APP error mentioned in the doc. – Aldian Fazrihady Oct 14 '15 at 10:03
  • This is for debug or release ? I had the same error with the release build variant and had to add an additional SHA1 fingerprint of my keystore – Rushikesh Gomekar Nov 15 '15 at 09:50

8 Answers8

8

It's because the package that you put on the credentials section on the Developers Console is different to the project you are building.

  1. Open https://console.developers.google.com
  2. Go to APIs & auth menu on the left side, and go to Credentials
  3. You can add new Android API and put the package you are building, or edit any existing and add another package name and fingerprint (SHA1).
denilukman
  • 116
  • 2
3

I was getting the 'PLACES_API_INVALID_APP' even after posting my release SHA1. After trying everything I found out my release app was not even signed with the SHA1 I was getting from the keystore. So I did this:

1.Go to google play console

2.Release Management > App Signing > App signing certificate

3.Copy the SHA1 of App signing certificate and paste in google api console's credential page

Now you are good to go! Sadly it is not documented anywhere currently.

Ratul Bin Tazul
  • 2,121
  • 1
  • 15
  • 23
2

Follow my steps:

1> Creating one new projects on Google Developer Console

2> API Manager > Credentials > New Credentials > API Key > Android Key > Press Create Button & Generate API KEY

Here, Creating key without applying package of application & SHA fingerprint is working in any application

MUST REMEMBER:

Enable Google Places API for Android

Dhruv Raval
  • 4,946
  • 3
  • 29
  • 34
2

In my case SHA-1 certificate fingerprint was for debug build only, I added release SHA-1 key also. Now it's working.

Make sure you use the exact packageName and valid SHA-1 key for debug as well as release app

activesince93
  • 1,716
  • 17
  • 37
1

Status{statusCode=PLACES_API_INVALID_APP, resolution=null}

it means your api key invalid so create API key with your Package name and SHA Fingerprint

STEPS fot Creating API KEY

1.Get information about your app's certificate (SHA fingerprient).

2.Register a project in the Google Developers Console

3.Add the Google Places API as a service for the project, and create an API key.

4.Add the key to your app manifest.

sivaBE35
  • 1,876
  • 18
  • 23
  • Thanks for mentioning the SHA1 hash code of the keystore. As a reference for future readers, make sure to update the SHA1 value associated with your API Key (of `Google Places API for Android`) in Google Cloud console if you have changed your keystore (if you have started using `Google Play App Signing`). – Javad Mar 21 '18 at 18:53
1

I was seeing this error in the Google Play Console pre-launch report, despite having added the Google Play App Signing SHA-1 certificate.

Turns out there is an option in the pre-launch report's settings menu called pre-launch report version, which says:

Pre-launch report now explores your app even more deeply and may find more crashes. However, in order to do so, it will temporarily re-sign your APK within our lab environment.

I've enabled the option to opt-out of pre-launch reports where the app is re-signed, and the error has gone away.

Click on your application > Release management > Pre-launch report > Settings > Pre-launch report version.

This won't help you fix the error on a real device, but it fixed my issue.

Credit to this answer for pointing me towards this.

alstr
  • 1,358
  • 18
  • 34
0

Although I have enable Android Place API from developer console but i came across this error:

Status{statusCode=PLACES_API_INVALID_APP, resolution=null}

Then I go to developer console and select my project registered earlier, and follow the option of "Get Place API key" for my project. I resolved it this way.

zx485
  • 28,498
  • 28
  • 50
  • 59
Taimur
  • 559
  • 11
  • 24
0

Make sure that you have the API meta-data placed in Manifest.xml file

 <meta-data android:name="com.google.android.geo.API_KEY" android:value="You API Key Here"/>
Bertram Gilfoyle
  • 9,899
  • 6
  • 42
  • 67
Omar Rehman
  • 2,045
  • 17
  • 17