android studio java.exe以非零退出值2结束

时间:2017-01-16 17:31:49

标签: java android android-studio sdk

gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.hw.minesweeper"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies 
{

    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:support-v4:23.0.0'
    compile 'com.android.support:design:23.0.0'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.google.android.gms:play-services-gcm:10.0.1'
    compile 'com.google.android.gms:play-services-maps:10.0.1'
    compile 'com.google.android.gms:play-services-location:10.0.1'
    compile 'com.google.android.gms:play-services:10.0.1'
}

这是来自gradle build的消息

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2400Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72400Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2300Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72400Library UP-TO-DATE
:app:prepareComAndroidSupportPaletteV72400Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42400Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2400Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAwareness1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCastFramework1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesClearcut1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGass1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIid1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesInstantapps1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlaces1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanager1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerV4Impl1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTasks1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet1001Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalytics1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAppindexing1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuth1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCommon1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseConfig1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCrash1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabase1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseIid1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseMessaging1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorage1001Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorageCommon1001Library 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:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithDexForDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
    com.android.build.api.transform.TransformException:
    com.android.ide.common.process.ProcessException:  
    org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_73\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 2 mins 34.488 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

1 个答案:

答案 0 :(得分:1)

您是否尝试启用multidex?在您的gradle中尝试以下代码

defaultConfig {
    applicationId "com.example.hw.minesweeper"
    minSdkVersion 19
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"

    multiDexEnabled true
}