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?
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:
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.
It's because the package that you put on the credentials section on the Developers Console is different to the project you are building.