无法解析符号 GOOGLE_SIGN_IN_API.. Google 在我的应用程序中登录,无法访问变量 Auth.GOOGLE_SIGN_IN_API
Cannot resolve symbol GOOGLE_SIGN_IN_API.. Google sign-in in my app, Unable to access variable Auth.GOOGLE_SIGN_IN_API
我一直在将 Google 登录集成到我的 Android 应用程序中。
我一直在关注 Google 的 Android 教程。
(https://developers.google.com/identity/sign-in/android/sign-in)
过程中遇到了这个问题。
// 构建一个 GoogleApiClient,可以访问 Google 登录 API 和
// gso 指定的选项。
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
无法解析符号 GOOGLE_SIGN_IN_API
这就是我面临的问题。
我一直严格遵循上述 link 中描述的所有步骤。所有的依赖项和插件都是一样的,问题仍然存在。我该如何解决这个问题并继续前进?任何答案将不胜感激..
***************更新***************
这是我的应用程序gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId 'com.cloudtree.glue'
minSdkVersion 16
targetSdkVersion 23
versionCode 3
versionName "1.2"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
lintOptions {
disable 'MissingTranslation'
}
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/google-play-services.jar')
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/httpclient-4.2.1.jar')
compile files('libs/httpcore-4.2.1.jar')
compile files('libs/apache-mime4j-core-0.7.2.jar')
compile files('libs/httpmime-4.2.1.jar')
compile project(':volley')
compile project(':mediapicker')
compile 'com.android.support:support-v4:18.0.+'
compile 'com.google.android.gms:play-services-auth:9.8.0'
}
apply plugin: 'com.google.gms.google-services'
这是我的项目gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
更新您的 gradle 文件
compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.google.android.gms:play-services:10.2.0'
用这个替换你的 gradle 依赖项,如有任何疑问请告诉我
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/httpclient-4.2.1.jar')
compile files('libs/httpcore-4.2.1.jar')
compile files('libs/apache-mime4j-core-0.7.2.jar')
compile files('libs/httpmime-4.2.1.jar')
compile project(':volley')
compile project(':mediapicker')
compile 'com.android.support:support-v4:18.0.+'
compile 'com.google.android.gms:play-services-auth:9.8.0'
我一直在将 Google 登录集成到我的 Android 应用程序中。 我一直在关注 Google 的 Android 教程。 (https://developers.google.com/identity/sign-in/android/sign-in) 过程中遇到了这个问题。
// 构建一个 GoogleApiClient,可以访问 Google 登录 API 和 // gso 指定的选项。
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
无法解析符号 GOOGLE_SIGN_IN_API 这就是我面临的问题。
我一直严格遵循上述 link 中描述的所有步骤。所有的依赖项和插件都是一样的,问题仍然存在。我该如何解决这个问题并继续前进?任何答案将不胜感激..
***************更新*************** 这是我的应用程序gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId 'com.cloudtree.glue'
minSdkVersion 16
targetSdkVersion 23
versionCode 3
versionName "1.2"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
lintOptions {
disable 'MissingTranslation'
}
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/google-play-services.jar')
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/httpclient-4.2.1.jar')
compile files('libs/httpcore-4.2.1.jar')
compile files('libs/apache-mime4j-core-0.7.2.jar')
compile files('libs/httpmime-4.2.1.jar')
compile project(':volley')
compile project(':mediapicker')
compile 'com.android.support:support-v4:18.0.+'
compile 'com.google.android.gms:play-services-auth:9.8.0'
}
apply plugin: 'com.google.gms.google-services'
这是我的项目gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
更新您的 gradle 文件
compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.google.android.gms:play-services:10.2.0'
用这个替换你的 gradle 依赖项,如有任何疑问请告诉我
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/httpclient-4.2.1.jar')
compile files('libs/httpcore-4.2.1.jar')
compile files('libs/apache-mime4j-core-0.7.2.jar')
compile files('libs/httpmime-4.2.1.jar')
compile project(':volley')
compile project(':mediapicker')
compile 'com.android.support:support-v4:18.0.+'
compile 'com.google.android.gms:play-services-auth:9.8.0'