不能导入com.google.android.gms.location.LocationServices [英] Can't Import com.google.android.gms.location.LocationServices
问题描述
我试图得到最准确的位置。
I'm trying to get the most accurate location.
到现在我心中已经成功地使用LocationClient在谷歌文档:
http://developer.android.com/training/location/retrieve-current.html
till now I'v used successfully LocationClient as in Google docs: http://developer.android.com/training/location/retrieve-current.html
但现在我发现,这个类是旧的:
的http://developer.android.com/reference/com/google/android/gms/location/package-summary.html
But now I have discovered that this class is old: http://developer.android.com/reference/com/google/android/gms/location/package-summary.html
的该类德precated。使用LocationServices。的
然而,即使在此网站LocationServices的例子:
<一href=\"http://stackoverflow.com/questions/24611977/android-locationclient-class-is-de$p$pcated-but-used-in-documentation\">Android LocationClient类去precated但在文档中使用
However in the examples of LocationServices even in this site: Android LocationClient class is deprecated but used in documentation
这似乎我们应该使用导入:com.google.android.gms.location.LocationServices
不过,我不能导入这个类。
It seem we should use an import: com.google.android.gms.location.LocationServices However I can't import this class..
任何想法?
编辑:
我在本页面发现:
h2ttps://github.com/M66B/XPrivacy/issues/1774
I have found in this page: h2ttps://github.com/M66B/XPrivacy/issues/1774
看似类似的问题,一个猜测:
的似乎是发挥服务5.0的一部分。的结果
我不知道如果是这样的话 - 有没有人尝试过呢?
with seemingly similar problem, a speculation that:
"Seems to be part of Play services 5.0."
I wonder if that is the case -- has anybody tried this ?
推荐答案
请确保你有你的依赖的gradle以下项目:
Make sure you have the following item in your gradle dependency:
dependencies {
compile 'com.google.android.gms:play-services-location:7.+'
}
这篇关于不能导入com.google.android.gms.location.LocationServices的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!