Android的工作室无法解决com.google.android.gms.location.places.AutocompleteFilter [英] Android studio can not resolve com.google.android.gms.location.places.AutocompleteFilter
问题描述
我想实现一个自动完成地方搜索下面这篇文章。
I am trying to implement a autocomplete places search following this article.
http://www.truiton.com/2015 / 04 / Android的地方-API自动完成-getplacebyid /
我按照所有的步骤,并以我build.gradle文件中添加适当的相关性。
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" />
还我已经安装了所有必需的SDK组件。不过我的机器人工作室无法解决的地方以下进口部分:
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.
我怎样才能解决这个问题?我使用的SDK 19我的应用程序。
How can I resolve this issue? I am using SDK 19 for my app.
推荐答案
该API的地方只在的谷歌Play业务7.0 :你需要更新你的依赖将至少 7.0.0
,虽然最新作这个答案是 7.5.0
。
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 7.5.0
.
注意的几乎所有情况下的,你应该使用选择性的API 只包括谷歌的部分游戏,你需要的服务。在这种情况下,你实际使用的依赖,如
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
compile 'com.google.android.gms:play-services-location:7.5.0'
这篇关于Android的工作室无法解决com.google.android.gms.location.places.AutocompleteFilter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!