简体   繁体   中英

Execution failed for task ':app:preDexDebug' Adding jersey dependencies give build error

I created an Android project in Intellij with empty activity. And then I added Jersey libraries as dependencies in gradle as follow :

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

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

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

   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'

}

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