简体   繁体   中英

Error Gradle Build C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1

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.7.0_79\\bin\\java.exe'' finished with non-zero exit value 1

Here is my gradle build file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "br.com.gerenciarsc.nfce"
        minSdkVersion 12
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile('org.simpleframework:simple-xml:2.7.1') {
        exclude group: 'xpp3', module: 'xpp3'
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'stax', module: 'stax'
    }
    compile 'com.google.code.gson:gson:2.5'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.j256.ormlite:ormlite-core:4.48'
    compile 'com.j256.ormlite:ormlite-android:4.48'
    compile 'com.beardedhen:androidbootstrap:2.0.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
    compile 'com.google.zxing:core:3.2.0'
    compile 'br.com.uol.ps:library:0.8'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'javax.xml.crypto:jsr105-api:1.0.1'
    compile ('commons-io:commons-io:2.4'){
        exclude group: 'org.apache.commons.collections', module: 'org.apache.commons.collections'
    }    
}

I faced the same issue. Scrolling down, I found the following error in the logs:

java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0

Then I searched for the above error and found the following work-around as suggested by the solutions to this question and another similar question :

In the file build.gradle(Module:app) I changed the following from:

buildToolsVersion "24.0.0"

to

buildToolsVersion "23.0.2"

and clicked the button to "sync project with gradle files" in Android Studio and the error vanished.

Note : I didn't understand the exact reason for the error and it's solution completely but it seems to be a compatibility issue of java version 1.7 and Android API level 24. Some people suggested (on the questions' links I mentioned) to use JDK version 8 with API 24, or downgrade it to JDK version 7 and API level 23.0.x as a work around.

Found cause and solution.

All at the sudden this happened, when I created a class with the same signature (package and name) in 2 different projects of my environment and started the App to try it. Got that message.

I discovered it by adding multiDexEnabled true and new error message appeared with duplicated class found.

So, I refactored the class (changed package name), also removed multiDexEnabled support as it was before, the App started.

I also faced the same issue after did reach i got resolved. issue could be the classes folder not created under build directory while you build the project, the reason for that the project path may not correct. so you have to correct the project path and rebuild that it will work fine. java files should be under path \\src\\main\\java for gradle proejct

I've got this error:

Execution failed for task ':vvm:transformClassesWithDesugarForRelease'. com.android.build.api.transform.TransformException: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'E:\\Java\\jdk1.8.0_181\\bin\\java.exe''

I've solved it by updating gradle from 4.4 to 5.4

I also faced the same issue after did reach i not resolved. instead of applied two approaches as follows:

Process 1: Update plugin with build.gradle

plugins {
id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
}

Process 2: Update the JAVA path while executing the application inside the IDE

Still it is not working.

就我而言,我将 build.gradle(module:app) 中的 buildToolVersion 更改为 23.0.2,然后应用程序正在运行。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM