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?
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
Although I have enable Android Place API from developer console but i came across this error:
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.
Make sure that you have the API meta-data placed in Manifest.xml file
In my case
SHA-1 certificate fingerprint
was fordebug
build only, I addedrelease
SHA-1 key also. Now it's working.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.
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.