在Android应用程序中实现google plus登录时出错

时间:2015-06-08 13:03:58

标签: java android

我在通过Android应用程序实施Google Plus Api登录时出现此错误,我们如何解决此错误,请帮助我解决此问题,我已经从google开发者控制台生成访问权限,但我没有任何想法在何处使用它们。当我们执行时,它总是给我相同的结果。

 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'

}

1 个答案:

答案 0 :(得分:-1)

我也遇到了类似的问题。我认为问题在于游戏服务是所有库的捆绑,其中还包括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'
不要忘记清理构建项目并重新构建它。