簡體   English   中英

Gradle構建錯誤:Android java.exe以非零退出值1結束

[英]Gradle build error:Android java.exe finished with non-zero exit value 1

已經在以下所有鏈接上試用了解決方案: Gradle Build Errors

Android Studio Gradle Error - preDexDebug

Android java.exe以非零退出值1結束

完成非零退出值

任務執行失敗:':app:preDexDebug'

http://fqa.io/questions/29045129/android-java-exe-finished-with-non-zero-exit-value-1

http://fqa.io/questions/28933701/android-studio-unable-to-resolve-error-apppredexdebug

錯誤仍然存​​在。 任何幫助將真正受到贊賞。 謝謝!

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:prepareComAndroidSupportAppcompatV72211Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42211Library 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 FAILED
Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 1

當我使用--debug選項運行時,它會將錯誤顯示為:

Error:05:43:59.724 [ERROR] [org.gradle.BuildExceptionReporter] 
05:43:59.725 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
05:43:59.726 [ERROR] [org.gradle.BuildExceptionReporter] 
05:43:59.727 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
05:43:59.728 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':app:preDexDebug'.
05:43:59.729 [ERROR] [org.gradle.BuildExceptionReporter] > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 1
05:43:59.732 [ERROR] [org.gradle.BuildExceptionReporter] 
05:43:59.733 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
05:43:59.734 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. 

以及build.gradle的內容(Project:MyApplication)

// 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:1.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

build.gradle的內容(模塊:app):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.user.myapplication"
        minSdkVersion 8
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
}

我突然遇到同樣的錯誤,我意識到這是因為新的Google Play服務庫。

我換了這條線

compile 'com.google.android.gms:play-services:7.3.0'

回到

compile 'com.google.android.gms:play-services:7.0.0'

我可以再次運行該應用程序。 一旦我更新到7.3.0,問題就會重新出現(每一次)。

我使用的是Android Studio 1.2,gradle插件1.2.2,compileSdkVersion 22,buildToolsVersion 22.0.1。

試試你說的是什么標記,但你保留com.android.tools.build:gradle:1.1.0

盡量確保你保持最新,尤其是build tools Android應用程序時的build tools

熱門build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.2' // <-- was 1.1.0

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

app / build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22 // <-- was 21
    buildToolsVersion "22.0.1" // <-- was 21.1.2

    defaultConfig {
        applicationId "com.example.user.myapplication"
        minSdkVersion 9
        targetSdkVersion 22 // <-- was 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:22.1.1'
}

我有同樣的錯誤。 我正在使用不同的SDK構建工具構建使用此錯誤的庫。 我只需右鍵單擊該庫,對於我的情況“google maps”,單擊“打開模塊設置”,然后將Compile SDK版本以及構建工具版本更改為我用於我的相同版本app目錄

就我而言,我通過在dexOptionsapp/build.gradle )中刪除incremental true來解決這個問題。

incrementalmultidex是不可能的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM