【问题标题】:Can't find symbol variable "LocationServices" in GoogleApiClient instance?在 GoogleApiClient 实例中找不到符号变量“LocationServices”?
【发布时间】:2016-11-29 03:46:34
【问题描述】:

我是 GeoFencing 的新手,我正在尝试将 API 添加到 GoogleApiClient 实例。但它显示错误,例如找不到变量 LocationServices。 这是我的代码:

private void createGoogleApi() {
    Log.d(TAG, "createGoogleApi()");
    if ( googleApiClient == null ) {
        googleApiClient = new GoogleApiClient.Builder( this )
                .addConnectionCallbacks( this )
                .addOnConnectionFailedListener( this )
                .addApi(LocationServices.API)
                .build();
    }
}

我的毕业典礼是

 compile 'com.google.android.gms:play-services-maps:9.8.0'

清单文件

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET" />
 <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="Server_key" />

你能看看这个吗?或者你可以提供一些其他文档或链接以供参考。谢谢

【问题讨论】:

标签: java android google-maps google-location-services


【解决方案1】:

在 gradle 中添加播放服务位置

dependencies {
compile 'com.google.android.gms:play-services-location:9.8.0'
}

一旦您检查所有更新都在 SDK 中完成。

【讨论】:

    【解决方案2】:

    我认为你错过了这样的事情:

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

    供进一步参考see here

    【讨论】:

      【解决方案3】:

      您只需在应用级别的 build.gradle 文件中添加以下行

      compile 'com.google.android.gms:play-services:10.0.1'
      

      【讨论】:

        猜你喜欢
        • 2014-09-22
        • 2023-04-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-09-14
        • 2016-07-01
        • 2016-03-27
        相关资源
        最近更新 更多