无法解析符号'GooglePlayServicesClient“符号、GooglePlayServicesClient

2023-09-06 03:08:43 作者:为消逝的时光默哀

我试图将项目从Eclipse的移植到Android的工作室,该项目可建立在Eclipse中,并成功导入到Android的工作室,不过,我得到无法解析符号GooglePlayServicesClient在Android的工作室错误。

我跟着官方教程,在Android的工作室导入谷歌Play服务,以及用在其他包 com.google.android.gms.common.ConnectionResult 我的项目没有同样的问题。只有 GooglePlayServicesClient 无法得到解决。

我自己也尝试干净,重建我的项目,但问题仍然存在。我究竟做错了什么?

更新:

我的 build.gradle

  ...
依赖{
    编制项目(:libraryListViewAnimations)
    编译com.android.support:support-v4:21.0.3
    编译com.android.support:appcompat-v7:21.0.3
    编译com.google.android.gms:播放服务:+
    编译com.google.android.gms:播放服务:7.0.0
    编译文件(库/的activati​​on.jar)
    编译文件(库/ additionnal.jar)
    编译文件(库/公网-3.1-sources.jar)
    编译文件(库/公网-3.1.jar)
    编译文件(库/的mail.jar)
}
 

解决方案

GooglePlayServicesClient已过时,不再包含在谷歌播放服务7.x的图书馆。谷歌建议使用GoogleApiClient代替。

请参阅访问谷歌的API 的在Android开发者文档:

注意:如果你有一个现有的应用程序,连接到谷歌播放服务,GooglePlayServicesClient的子类,则应该迁移到尽快GoogleApiClient。的

谁知道中间那两个人名字里的符号怎么打的啊 方法教我一下呗

I am trying to migrate a project from Eclipse to Android Studio, the project can be build in Eclipse and was successful imported to Android Studio, however, I get Cannot resolve symbol 'GooglePlayServicesClient' error in Android Studio.

I followed the official tutorial to imported Google Play service in Android Studio, and an other package "com.google.android.gms.common.ConnectionResult" that used in my project does not have same issue. Only 'GooglePlayServicesClient' cannot be resolved.

I have also tried clean and rebuild my project, but the problem persists. What am I doing wrong?

Update:

My build.gradle

...
dependencies {
    compile project(':libraryListViewAnimations')
    compile 'com.android.support:support-v4:21.0.3'
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.google.android.gms:play-services:7.0.0'
    compile files('libs/activation.jar')
    compile files('libs/additionnal.jar')
    compile files('libs/commons-net-3.1-sources.jar')
    compile files('libs/commons-net-3.1.jar')
    compile files('libs/mail.jar')
}

解决方案

GooglePlayServicesClient is obsolete and no longer included in the Google Play Services 7.x library. Google recommends using the GoogleApiClient instead.

See Accessing Google APIs in the Android developer docs:

"Note: If you have an existing app that connects to Google Play services with a subclass of GooglePlayServicesClient, you should migrate to GoogleApiClient as soon as possible."