5

I want to update my app, but when I try to generate a signed apk, I receive an error with these messages:

Warning:warning: Cannot find annotation method 'value()' in type 'GuardedBy': class file for javax.annotation.concurrent.GuardedBy not found

Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lbolts/AppLink$Target;

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

Please help!!

bit
  • 4,407
  • 1
  • 28
  • 50
LKH
  • 287
  • 2
  • 3
  • 11

1 Answers1

3

Try multiDexEnabled true like this:

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

        multiDexEnabled true
    }
}

EDIT : And if you don't know which part to exclude just add below code to your build.gradle just below defaultConfig:

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/notice.txt'
}
Janki Gadhiya
  • 4,492
  • 2
  • 29
  • 59