Android Google Places API “PLACES_API_QUOTA_FAILED”

穿精又带淫゛_ 提交于 2019-12-07 19:47:32

问题


Ok, so I am kinda new to Google maps/geo etc. So I went to the Google console, added an application, enabled "Places API for Android", copy pasted the API key like this :

<meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="API-KEY" />

I have an activity where I did

mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this, 0 /* clientId */, this) .addApi(Places.GEO_DATA_API) .build();

Copy pasted the adapter from the samples code. Everything compiled fine, autocompletetextview was setup properly and all.

Now when I started typing, it throws an error immediately Error getting autocomplete prediction API call: Status{statusCode=PLACES_API_QUOTA_FAILED, resolution=null}

I searched and searched and guess what, google doesn't even have this error code in their documentation! Has anybody faced this? Am I missing something here?

P.S - I added the app a day ago so definitely my quota is not over. Also its a different error code for exhausted quota.


回答1:


Sorry about this confusing error code—we're working on getting that fixed.

This could be due to an incorrect certificate fingerprint in your Developers Console configuration. Would you mind double checking the instructions at https://developers.google.com/places/android/signup#find-cert?

Let me know if that works.




回答2:


So, the problem was, I had generated an "Android Key" (which I thought was logical because I was developing an android app). That didn't work and gave me this confusing code. Then I went back, deleted that key, and generated a "Server Key" and pasted that code in the app manifest. Guess what, it worked!

Most peculiar behavior and this step is not even mentioned in the documentation as to why this is logical.




回答3:


I had the same issue. For me the problem was fixed by enabling the api via:

https://console.developers.google.com/flows/enableapi?apiid=placesandroid&keyType=CLIENT_SIDE_ANDROID&reusekey=true

and regenerate key as a server one




回答4:


In my case, the error was generated because a new sdk and android studio install. So, just following the steps in the Google tutorial solved the problem: https://developers.google.com/places/android/signup#find-cert




回答5:


I changed my package name during the development stage. After changing the package name on the Developers Console api key apps I came across this error. The solution was to simply wait 5 minutes or so after changing the key in the Developers Console. The Developers Console does clearly state this but it's easy to ignore.




回答6:


This happened with me when using genymotion. This also happens on devices and emulator. With me I choose Run option from `android studio. Which does not build a signed APK. Google Map services need a signed apk for running.

Build a signed APK and drag and drop it into genymotion (install it using adb install) for it to work.



来源:https://stackoverflow.com/questions/31846229/android-google-places-api-places-api-quota-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!