我一直在将Google Sign-In集成到我的Android应用程序中。我一直在关注谷歌的Android版本。(https://developers.google.com/identity/sign-in/android/sign-in(在此过程中,我遇到了这个问题。
构建一个可以访问 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这就是我面临的问题。
我一直严格按照上述链接中所述的所有步骤进行操作。所有依赖项和插件都相同,问题仍然存在。如何解决此问题并继续前进?任何答案将不胜感激。
***************更新***************这是我的应用成绩
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'
这是我的项目成绩
// 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 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'
更新您的 gradle 文件
compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.google.android.gms:play-services:10.2.0'