Android的错误:无法找到符号类LocationClient [英] Android error: cannot find symbol class LocationClient
问题描述
我和我的Android项目的一个问题。错误:不能因为这个错误来打造找不到符号类LocationClient。我已经红认为你需要使用谷歌的低版本的播放服务,如'com.google.android.gms:发挥服务:5 +'。
但是,当我用一个我得到另一个错误:错误:属性的主题已定义。当我用Google搜索,一个是说,我需要使用更高版本的谷歌的播放服务,如com.google.android.gms:发挥服务:6 +'。
所以,我需要同时使用版本5 +和6 +但这是不可能的。是否有任何解决方案,为这个问题?
这是我的脚本的gradle:
应用插件:'com.android.application安卓{compileSdkVersion谷歌Inc.:Google的API:21'
buildToolsVersion19.1.0
defaultConfig {
的applicationIDAPP_ID
19的minSdkVersion
targetSdkVersion 21
}buildTypes {
发布 {
minifyEnabled假
proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard的-rules.txt
}
}
}依赖{
//尝试过不同版本的图书馆的,没有成功
编译com.android.support:support-v4:22.0.0
编译com.android.support:appcompat-v7:22.0.0
编译com.google.android.gms:游戏服务:87年6月5日
编译com.google.android.gms:播放服务:5 +'
}
这是我可以做的是更换了与GoogleApiClient的LocationClient最好的事情。由于LocationClient是德precated。更换类是GoogleApiClient。它有类似的功能,因此它很容易更换。
Documententation:<一href=\"https://developer.android.com/reference/com/google/android/gms/common/api/GoogleApiClient.html\" rel=\"nofollow\">https://developer.android.com/reference/com/google/android/gms/common/api/GoogleApiClient.html
I have a problem with my Android project. It can't be build because of this error: error: cannot find symbol class LocationClient. I already red that you need to use a lower version of google play services like 'com.google.android.gms:play-services:5.+'.
But when I use that one I get another error: Error:Attribute "theme" has already been defined. And when I googled that one it said that I need to use a higher version of google play services like 'com.google.android.gms:play-services:6.+'.
So I need to use both version 5.+ and 6.+ but that is not possible. Are there any solutions for this problem?
This is my gradle script:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:21'
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "app_id"
minSdkVersion 19
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
//tried different versions of the librarys, without success
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.google.android.gms:play-services:5.+'
}
The best thing that I could do is replace the LocationClient with the GoogleApiClient. Because LocationClient is deprecated. The replacement class is the GoogleApiClient. It has similar functions so its easy to replace.
Documententation: https://developer.android.com/reference/com/google/android/gms/common/api/GoogleApiClient.html
这篇关于Android的错误:无法找到符号类LocationClient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!