gpt4 book ai didi

android studio 无法解析符号 LocationClient

转载 作者:行者123 更新时间:2023-11-29 20:52:32 25 4
gpt4 key购买 nike

我正在使用 AndroidStudio 并尝试使用 googleplayservices 进行地理编码。

我遵循了 android 教程: http://developer.android.com/google/play-services/setup.html

但是在我的导入中我有下划线:导入 android.location.LocationClient;上面写着:无法解析符号位置客户端

有什么想法吗?

我的代码如下:

//imports
...
import android.location.Location;
import com.google.android.gms.location.LocationClient;
import android.location.LocationClient;
...

构建.grandle

...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile files('libs/android-async-http-1.4.6.jar')
compile 'com.google.android.gms:play-services:6.5.87'
}
...

最后是我的 xml list :

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.name.application_name" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.READ_LOGS"/>
....
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
....

最佳答案

android.location 中没有LocationClient .这就是您的导入导致错误的原因。

事实上,LocationClient 类已被弃用。来自 Google Play Services | Android Developers :

Deprecated clients - The ActivityRecognitionClient, LocationClient, and PlusClient classes are deprecated. If you used those APIs in your app and want to call Google Play services 6.5 or higher APIs, you must switch to the new programming model that utilizes GoogleApiClient. For more information about using GoogleApiClient, see Accessing Google APIs.

Use these APIs instead of the deprecated APIs:

...If you were previously using LocationClient, call the APIs in the com.google.android.gms.location package instead.

有关从 LocationClient 迁移到 GoogleApiClient 的快速信息, 请参阅 android - LocationClient class not found on google play services rev 22

关于android studio 无法解析符号 LocationClient,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28734194/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com