错误Grandle Build C:\ Program Files \ Java \ jdk1.7.0_79 \ bin \ java.exe”以非零退出值1结束

错误:任务’:app:transformClassesWithDexForDebug’的执行失败

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 

com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程’命令’C:\ Program Files \ Java \ jdk1.7.0_79 \ bin \ java.exe”以非零退出值1结束

这是我的gradle构建文件:

 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' } } 

你能帮我么?

我遇到了同样的问题。 向下滚动,我在日志中发现以下错误:

java.lang.UnsupportedClassVersionError:com / android / dx / command / Main:不支持的major.minor版本52.0

然后,我搜索了上述错误,并找到了以下解决方案,如此问题的解决方案和另一个类似问题的建议 :

在文件build.gradle(Module:app)中,我更改了以下内容:

buildToolsVersion "24.0.0"

buildToolsVersion "23.0.2"

并单击Android Studio中的“与gradle文件同步项目”按钮,错误消失。

注意 :我完全不理解错误的确切原因和解决方案,但它似乎是java版本1.7和Android API级别24的兼容性问题。有人建议(在我提到的问题链接上)使用JDK使用API​​ 24的版本8,或将其降级为JDK版本7和API级别23.0.x作为解决方法。

找到原因和解决方案。

突然发生这种情况,当我在我的环境的2个不同项目中创建了一个具有相同签名(包和名称)的类时,启动了App来尝试它。 得到那个消息。

我发现它通过添加multiDexEnabled true和新的错误消息出现与重复的类找到。

所以,我重构了这个类(更改了包名),也删除了之前的应用程序启动时的multiDexEnabled支持。

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