Android studio 无法解析com.google.android.gms.location.places.AutocompleteFilter [英] Android studio can not resolve com.google.android.gms.location.places.AutocompleteFilter
问题描述
我正在尝试按照本文实现自动完成位置搜索.
:您需要将依赖项更新为至少 7.0.0
,尽管最新的答案是15.0.0
.
注意几乎所有情况,您应该使用选择性API 仅包含您需要的 Google Play 服务部分.在这种情况下,您实际上会使用诸如
之类的依赖项实现'com.google.android.gms:play-services-location:15.0.0'
I am trying to implement a autocomplete places search following this article.
http://www.truiton.com/2015/04/android-places-api-autocomplete-getplacebyid/
I have followed all steps, and also added proper dependencies in my build.gradle file.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
}
Also here are the meta data section in my manifest.
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key" />
also I have all the required SDK components installed. Still my android studio can not resolve the places part in the following imports:
import com.google.android.gms.location.places.AutocompleteFilter;
import com.google.android.gms.location.places.AutocompletePrediction;
import com.google.android.gms.location.places.AutocompletePredictionBuffer;
import com.google.android.gms.location.places.Places;
this is how they look as they can not find the Places part.
How can I resolve this issue? I am using SDK 19 for my app.
The Places API was only added in Google Play services 7.0: you'll need to update your dependency to be at least 7.0.0
, although the latest as of this answer is 15.0.0
.
Note in almost every case, you should use selective APIs to only include the portions of Google Play services you need. In that case, you'd actually use a dependency such as
implementation 'com.google.android.gms:play-services-location:15.0.0'
这篇关于Android studio 无法解析com.google.android.gms.location.places.AutocompleteFilter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!