简体   繁体   English

我无法生成签名的apk

[英]I can't generate signed apk

I want to update my app, but when I try to generate a signed apk, I receive an error with these messages: 我想更新我的应用程序,但是当我尝试生成签名的apk时,我收到这些消息的错误:

Warning:warning: Cannot find annotation method 'value()' in type 'GuardedBy': class file for javax.annotation.concurrent.GuardedBy not found 警告:警告:无法在类型'GuardedBy'中找到注释方法'value()':找不到javax.annotation.concurrent.GuardedBy的类文件

Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lbolts/AppLink$Target; 错误:将字节码转换为dex时出错:原因:com.android.dex.DexException:多个dex文件定义Lbolts / AppLink $ Target;

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 错误:任务':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 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:进程'命令'/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java''以非零退出值2结束

Please help!! 请帮忙!!

Try multiDexEnabled true like this: 尝试multiDexEnabled true如下:

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 : 编辑:如果您不知道要排除哪个部分,只需将以下代码添加到defaultConfig下面的build.gradle:

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/notice.txt'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM