错误:包GooglePlayServicesClient不存在

Tyl*_*ope 10 android android-studio

我已经使用android studio向我的应用添加了登录活动但是我遇到了这些错误:

Error:(11, 37) error: cannot find symbol class GooglePlayServicesClient

Error:(13, 35) error: cannot find symbol class PlusClient

Error:(20, 44) error: package GooglePlayServicesClient does not exist

Error:(21, 33) error: package GooglePlayServicesClient does not exist

Error:(35, 13) error: cannot find symbol class PlusClient

Error:(279, 12) error: cannot find symbol class PlusClient

Error:(78, 31) error: package PlusClient does not exist

Error:(160, 65) error: package PlusClient does not exist

Error:(239, 5) error: method does not override or implement a method from a supertype

Error:(249, 5) error: method does not override or implement a method from a supertype

Error:(262, 5) error: method does not override or implement a method from a supertype
Run Code Online (Sandbox Code Playgroud)

我已经在我的SDK管理器中安装了google play服务,所以我不确定为什么它会告诉我包不存在.

编辑:Gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.tyler.titanaid"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.google.android.gms:play-services:7.0.0'
}
Run Code Online (Sandbox Code Playgroud)

小智 19

嘿,我也遇到了这个问题.我没有找到太多帮助,所以我做了很多阅读,发现(https://developer.android.com/google/auth/api-client.html)一个小小的说明,谷歌手机服务API已被弃用,每个人都必须转而使用GoogleApi.

注意:如果您的现有应用程序使用GooglePlayServicesClient的子类连接到Google Play服务,则应尽快迁移到GoogleApiClient.

我想在开发后期添加登录活动时,Android Studio尚未更新为自动输入新API而不是旧API.
因此,任何依赖GooglePlayServices的东西也必须更新,包括PlusClient和其他一些.

我已经看到在互联网上迁移工具,但它可能会让事情变得更容易.希望这可以帮助.

  • @TylerPope,android studio中有一个复选框,你可以点击创建没有Google API的LoginActivity. (2认同)