Error Gradle Build C:\ Program Files \ Java \ jdk1.7.0_79 \ bin \ java.exe完成,退出值非零1 [英] Error Gradle Build C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
问题描述
错误:任务':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''以非零退出值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
这是我的gradle构建文件:
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: 不支持的major.minor版本52.0
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:
在文件build.gradle(Module:app)中,我将以下内容更改为:
In the file build.gradle(Module:app) I changed the following from:
buildToolsVersion "24.0.0"
到
buildToolsVersion "23.0.2"
并在Android Studio中单击与gradle文件同步项目"按钮,错误消失.
and clicked the button to "sync project with gradle files" in Android Studio and the error vanished.
注意:我不完全理解该错误的确切原因,并且完全解决了该问题,但这似乎是Java版本1.7和Android API级别24的兼容性问题.有人建议(关于我提到的问题的链接)可以将JDK版本8与API 24一起使用,或者将其降级为JDK版本7和API级别23.0.x.
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.
这篇关于Error Gradle Build C:\ Program Files \ Java \ jdk1.7.0_79 \ bin \ java.exe完成,退出值非零1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!