Errors while building APK. You can find the errors in the 'Messages' view.

10 篇文章 0 订阅

最近在用Android Studio打包签名apk时遇到了一个问题,经过查找资料,顺利解决。

问题一:Messages报错如下:

Error:Execution failed for task ':app:lintVitalRelease'.
> Lint found fatal errors while assembling a release target.
To proceed, either fix the issues identified by lint, or modify your build script as follows:
...
android {
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}
...

解决方法:

在app的build.gradle里的android{}中添加如下代码,然后再次运行Generate Signed Apk。

android{
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}

问题二:Messages报错如下:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/cardview/BuildConfig.class

解决方法:

那就是说明你在工程中libs文件夹或是build.gradle中引用了重复的依赖包或是依赖工程,自己Ctrl+N,输入BackStackState查找一下是哪个包重复,那么就删除相应的libs中的jar包依赖,然后通过compile方式进行引用即可。

问题三:Messages报错如下:

dexDebug ExecException finished with non-zero exit value 2

解决方法:

需要在gradle中配置下面的代码,原因是引用了多个libraries文件

defaultConfig {
        multiDexEnabled true
}
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值