Android Studio GeoDataClient无法解析

Yag*_*rea 9 api gps android location geo

我没有在互联网上的任何地方看到这个问题,也似乎不赞成库,但我只是无法添加导入:

import com.google.android.gms.location.places.GeoDataClient;
Run Code Online (Sandbox Code Playgroud)

我的Android SDK是最新的.

有谁知道如何使用它?或者更确切地说,另一种获取GPS当前位置的方法?

非常感谢.

Xia*_*wei 11

只需添加:

compile 'com.google.android.gms:play-services-places:11.2.0'
Run Code Online (Sandbox Code Playgroud)

repositories {
    jcenter()
    maven {
        url "https://maven.google.com"
    }
}
Run Code Online (Sandbox Code Playgroud)

因为在11.2.0中添加了GeoDataClient,您可以查看此官方文档


jia*_*ang 6

尝试添加

```gradle这个

compile 'com.google.android.gms:play-services-maps:11.2.0'
compile 'com.google.android.gms:play-services-places:11.2.0'
compile 'com.google.android.gms:play-services:11.2.0'
compile 'com.google.android.gms:play-services-location:11.2.0'
Run Code Online (Sandbox Code Playgroud)

```in build.gradle,那么你可能需要添加

```gradle这个

allprojects {
repositories {
    jcenter()
    maven {
        url "https://maven.google.com"
    }
}
Run Code Online (Sandbox Code Playgroud)

}

```

最后,构建 - >重建项目.