无法将Google Places PlacePicker导入Android项目

Faw*_*ter 14 android google-places-api

我正在尝试编写一个简单的程序,涉及使用a 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'
}
Run Code Online (Sandbox Code Playgroud)

活动:

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;
Run Code Online (Sandbox Code Playgroud)

LatLng进口似乎工作,而不是其他两个.我导入完整的com.google.android.gms:play-services:9.2.0API 时整个项目运行正常,但我想使用特定的API调用来减少不必要的库.

Mig*_*gne 63

在播放服务中9.2.0,placesAPI不再位于location.现在这些都是他们自己的places依赖.要解决这些问题,您应该将其添加到您的build.gradle.

compile 'com.google.android.gms:play-services-places:9.2.0'

这里已经回答