[英]Execution failed for task ':app:preDexDebug' Adding jersey dependencies give build error
I created an Android project in Intellij with empty activity. 我在Intellij中创建了一个活动为空的Android项目。 And then I added Jersey libraries as dependencies in gradle as follow : 然后我将Jersey库添加为gradle中的依赖项,如下所示:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
// dependencies I added
compile 'com.sun.jersey:jersey-server:1.19'
compile 'com.sun.jersey:jersey-json:1.19'
} }
It started showing following error : 它开始显示以下错误:
Execution failed for task ':app:preDexDebug'. 任务':app:preDexDebug'的执行失败。
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\\Program Files\\Java\\jdk1.7.0_80\\bin\\java.exe'' finished with non-zero exit value 1 com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'C:\\ Program Files \\ Java \\ jdk1.7.0_80 \\ bin \\ java.exe'以非零退出值1
Hey @Kuldeep usually this error is because of multiple file with the same name you must check where is the redundant file and remove it maybe this is from the newly added library also try to add this inside of android tag in gradle file of your project 嘿@Kuldeep通常,此错误是由于多个文件具有相同的名称,您必须检查冗余文件在何处并将其删除,也许这是从新添加的库中也尝试将其添加到项目的gradle文件中的android标签中
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.