我正在使用Google的Camera2Basic example来测试Android Studio中的应用程序。我在运行项目时收到此错误:
错误:任务执行失败':应用程序:transformClassesWithDexForDebug'。 com.android.build.api.transform.TransformException:java.lang.RuntimeException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:进程'命令'C:\ Program Files \ Java \ jdk1.7.0_55 \ bin \ java.exe''以非零退出值1结束
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
dependencies {
compile "com.android.support:support-v4:23.3.0"
compile "com.android.support:support-v13:23.3.0"
compile "com.android.support:cardview-v7:23.3.0"
compile 'com.android.support:appcompat-v7:23.0.0'
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 23
buildToolsVersion "24.0.0 rc3"
defaultConfig {
minSdkVersion 21
targetSdkVersion 23
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
}
我做了什么
1)我在defaultConfig中添加了multiDexEnabled true
。
2)还尝试在依赖项中添加compile 'com.android.support:multidex:1.0.0'
。
答案 0 :(得分:2)
我已经改变了
buildToolsVersion "24.0.0 rc3"
与
buildToolsVersion "23.0.1"
在build.gradle文件中。现在,它正在运作。我不知道原因。如果有人知道原因,请编辑此答案。它会有所帮助。
感谢。