首页 > 解决方案 > android中的Google Map Places自动完成错误429

问题描述

我在谷歌地图位置 api 中面临 429 错误代码,而一切正常。我有结算帐户并且也限制了我的 api,但我收到以下错误。

{ "error": { "code": 429, "message": "资源已用完(例如检查配额)。", "errors": [ "message": "资源已用完(例如检查配额)。" ,“域”:“全局”,“原因”:“rateLimitExceeded”,“debugInfo”:“详细信息:“[原始错误] generic::resource_exhausted: com.google.api.server.core.Fault: ImmutableErrorDefinition{base= TOO_MANY_REQUESTS,category=QUOTA_ERROR,cause=null,debugInfo=null,domain=usageLimits,extendedHelp=null,httpHeaders={},httpStatus=tooManyRequests,internalReason=Reason{arguments={},cause=null,code=canonicalResourceExhaustedFromBackend,createdByBackend=错误,debugMessage=null,errorProtoCode=null,errorProtoDomain=null,filteredMessage=null,location=null,message=null,unnamedArguments=[]}, location=null, message=Rate Limit Exceeded, reason=rateLimitExceeded, rpcCode=429} Rate Limit Exceeded"\n" ], "status": "RESOURCE_EXHAUSTED" }


08-02 16:37:37.188 194-3188/? E/BufferQueueProducer: [InputMethod](this:0xb39bdc00,id:67,api:1,p:1263,c:194) allocateBuffers: slot 0 without buffer is not FREE
08-02 16:37:37.200 1580-3279/? E/art: invalid stream - problem with parameter iterator in /data/app/com.google.android.gms-2/base.apk:classes3.dex for method void com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.setSoWriteTimeout(int)
08-02 16:37:37.285 1580-3279/? E/art: invalid stream - problem with parameter iterator in /data/app/com.google.android.gms-2/base.apk:classes3.dex for method void com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.setSoWriteTimeout(int)
08-02 16:37:37.925 1580-3279/? E/Volley: [168] BasicNetwork.performRequest: Unexpected response code 429 for https://www.googleapis.com/placesandroid/v1/autocompleteWidget?key=AIzaSyCyJ-q6antCvgUAeYmix_5caFVwHhPiUgE
08-02 16:37:37.949 1580-6776/? E/ErrorUtils: Received generic error from server: 429
08-02 16:37:37.965 1580-6776/? E/AsyncOperation: serviceID=65, operation=AutocompleteWidgetQuota [CONTEXT service_id=259 ]
    OperationException[Status{statusCode=ERROR, resolution=null}]
        at bjnt.a(:com.google.android.gms@202614017@20.26.14 (040306-320008519):2)
        at bjnf.a(:com.google.android.gms@202614017@20.26.14 (040306-320008519):4)
        at zwo.run(:com.google.android.gms@202614017@20.26.14 (040306-320008519):9)
        at bmvl.run(:com.google.android.gms@202614017@20.26.14 (040306-320008519):2)
        at skp.b(:com.google.android.gms@202614017@20.26.14 (040306-320008519):12)
        at skp.run(:com.google.android.gms@202614017@20.26.14 (040306-320008519):7)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at sql.run(:com.google.android.gms@202614017@20.26.14 (040306-320008519):0)
        at java.lang.Thread.run(Thread.java:818)
08-02 16:37:37.996 6264-6264/? E/Places: Autocomplete widget closing due to ERROR

08-02 16:37:39.505 6264-6264/? E/Places: Unknown PlaceAutocompleteAdapter state change.
08-02 16:37:39.556 1580-8916/? E/AsyncOperation: serviceID=65, operation=AutocompleteWidgetQuota [CONTEXT service_id=259 ]

我的 build.gradle 具有以下依赖项

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation "androidx.recyclerview:recyclerview:1.1.0"
    implementation "androidx.recyclerview:recyclerview-selection:1.1.0-rc01"
    implementation "androidx.cardview:cardview:1.0.0"
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-places:17.0.0'
    implementation 'com.google.android.gms:play-services-auth:18.1.0'
    implementation 'com.facebook.android:facebook-android-sdk:4.12.1'
    implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    implementation 'com.splunk.mint:mint:5.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.stripe:stripe-android:2.1.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.squareup.okio:okio:1.6.0'
    implementation group: 'com.pubnub', name: 'pubnub-gson', version: '4.6.4'
    implementation 'com.google.firebase:firebase-messaging:20.2.3'
    implementation('com.twitter.sdk.android:twitter:3.0.0@aar') {
        transitive = true;
    }
    apply plugin: 'com.google.gms.google-services'
    implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
    implementation 'com.firebase:firebase-client-android:2.4.1+'
    implementation 'com.google.firebase:firebase-database:19.3.1'
    implementation 'com.firebaseui:firebase-ui:0.4.4'
    implementation 'com.google.firebase:firebase-core:17.4.4'
    implementation 'com.google.firebase:firebase-auth:19.3.2'
    implementation 'com.google.firebase:firebase-messaging:20.2.3'```  

What may be a cause of error?

标签: androidgoogle-mapsgoogle-api

解决方案


确保更新您的实现,如下所示: https ://developers.google.com/places/android-sdk/client-migration

Places SDK for Android 已被弃用。只需启用 Places API 并遵循迁移指南。


推荐阅读