首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Android Studio称places api未启用

Android Studio称places api未启用
EN

Stack Overflow用户
提问于 2019-03-17 18:27:40
回答 2查看 933关注 0票数 2

我正在尝试在我的应用程序中使用Places API。即使启用了Api,我的Logcat仍然给我这两个错误:

代码语言:javascript
运行
复制
03-17 05:31:34.777 2759-3241/com.google.android.gms.persistent E/Volley: 
[158] BasicNetwork.performRequest: Unexpected response code 403 for 
https://www.googleapis.com/placesandroid/v1/getAutocompletePredictions? 
key=<api key>

03-17 05:31:34.782 2759-7906/com.google.android.gms.persistent E/Places: 
Places API for Android does not seem to be enabled for your app. See 
https://developers.google.com/places/android/signup for more details.

我试着添加了

代码语言:javascript
运行
复制
implementation 'com.google.android.libraries.places:places-compat:1.0.0'

代码语言:javascript
运行
复制
implementation 'com.google.android.libraries.places:places:1.0.0'

但这两个似乎都没有帮助。我可以搜索一个位置,但是当我在搜索栏中输入时,我得到一个"Places_Api_Access_Not_Configured“错误。我的Api仪表板显示有活动,所以我不确定是什么问题。

这就是我的依赖项当前的样子

代码语言:javascript
运行
复制
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'

    implementation 'com.google.android.gms:play-services-location:16.0.0'
    //implementation 'com.google.android.gms:play-services-places:16.0.0'
    implementation 'com.google.android.libraries.places:places-compat:1.0.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.6'

    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'org.webjars.npm:debug:4.1.0'
    //implementation 'com.google.firebase:firebase-admin:6.7.0'
    //implementation 'com.firebase:geofire-android:2.1.1'
    implementation 'com.google.gms:google-services:3.1.1'

}
apply plugin: 'com.google.gms.google-services'
EN

回答 2

Stack Overflow用户

发布于 2019-03-23 07:34:04

如果您使用的是Place PickerPlace Autocomplete,则应避免使用它们,因为如here所示,自2019年1月29日起,它们已被弃用。

Place Picker的另一种选择是自己实现它,请参阅this线程。

如果你想使用Place Autocomplete,我建议你试试Pelias

票数 2
EN

Stack Overflow用户

发布于 2019-03-19 05:37:01

有时它们会出现缓存问题。尝试删除API密钥,然后重新创建它,。确保您没有限制API密钥。

只有在密钥正常工作后才能应用这些限制。注意,在使用新密钥之前,您可能需要等待5分钟。

在使用Google Places API for Web时,您还需要启用Google Maps JavaScript API。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55206041

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档