无法将Google Places Picker导入Android项目
我正在尝试编写一个简单的程序,其中包括使用无法将Google Places Picker导入Android项目,android,google-places-api,Android,Google Places Api,我正在尝试编写一个简单的程序,其中包括使用PlacePicker捕获位置信息。然而,我的项目似乎无法解决必要的导入问题 build.gradle: dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.3.0' compile 'com.g
PlacePicker
捕获位置信息。然而,我的项目似乎无法解决必要的导入问题
build.gradle
:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.google.android.gms:play-services-location:9.2.0'
compile 'com.google.android.gms:play-services-maps:9.2.0'
}
活动:
import com.google.android.gms.location.places.Place; // "Place" is not resolved
import com.google.android.gms.location.places.ui.PlacePicker; // "ui" is not resolved
import com.google.android.gms.maps.model.LatLng;
LatLng
导入似乎起作用,但其他两个似乎不起作用。当我导入完整的com.google.android.gms:play services:9.2.0
API时,整个项目运行良好,但我想使用特定的API调用来减少不必要的库。在play services9.2.0
中,places
API不再位于location
中。它们现在位于各自的位置
依赖项中。要解决这些问题,应将其添加到build.gradle
implementation'com.google.android.gms:play services places:9.2.0'
已经回答了你所说的“整个项目运行良好”是什么意思?你不是在导入完整的地图包吗?@cricket_007-看起来我最初的问题有错。我的意思是,只有当我导入完整的Google play服务包(即地图、位置、身份验证、身份、健身等)时,它才起作用,这是我不需要的大量多余的库。我会编辑这个问题,很好。谢谢。这花了太长时间才弄明白。我仍然很好奇,谷歌PlacesAPI的“入门”页面上是否有这样的说法?