PLACES_API_INVALID_APP error from Android Play Pla

2020-03-15 01:19发布

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?

8条回答
疯言疯语
2楼-- · 2020-03-15 02:17

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.

查看更多
老娘就宠你
3楼-- · 2020-03-15 02:20

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).
查看更多
登录 后发表回答