我在通过 Android 应用程序实现 Google Plus Api 登录时遇到此错误,我们如何解决此错误,请帮助我解决此问题,我已从 google 开发者控制台生成了访问 token ,但我没有任何访问 token 知道在哪里使用它们。当我们执行时,它总是多次给出相同的结果。
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72200Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42200Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet700Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable700Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzpa$zza;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_75\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 5.056 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
和我的 build.gradle 代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.health.weshallovercome"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.google.android.gms:play-services-plus:7.5.0'
}
最佳答案
我也遇到了类似的问题。我认为问题在于 play-service 是所有库的 bundle ,其中还包括 play-service-plus。加号按钮无需导入即可使用
compile 'com.google.android.gms:play-services-plus:7.5.0'
但是您不应该这样做,您应该仅导入所需的播放服务部分。 同样在删除
后compile 'com.google.android.gms:play-services-plus:7.5.0'
不要忘记清理构建项目并再次构建它。
关于java - 在 Android 应用程序中实现 google plus 登录时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30709907/