
因为混淆的问题生成Release版本失败
发布日期:2021-05-10 05:21:52
浏览次数:7
分类:技术文章
本文共 3207 字,大约阅读时间需要 10 分钟。
生成Release版本失败
异常是
Note: there were 19 references to unknown classes. You should check your configuration for typos. (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)Note: there were 1170 unkept descriptor classes in kept class members. You should consider explicitly keeping the mentioned classes (using '-keep'). (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)Note: there were 41 unresolved dynamic references to classes or interfaces. You should check if you need to specify additional program jars. (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)Warning: there were 1325 unresolved references to classes or interfaces. You may need to add missing library jars or update their versions. If your code works fine without the missing classes, you can suppress the warnings with '-dontwarn' options. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)Warning: there were 8 unresolved references to program class members. Your input classes appear to be inconsistent. You may need to recompile the code. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.Thread(Tasks limiter_2): destruction:demo:transformClassesAndResourcesWithProguardForBetaRelease FAILEDFAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':demo:transformClassesAndResourcesWithProguardForBetaRelease'.> Job failed, see logs for details* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 40s60 actionable tasks: 17 executed, 38 from cache, 5 up-to-date17:05:49: Task execution finished 'assembleRelease'.
可以看出来,我们就是混淆有问题,接下来解决。
找到异常位置
解决
有些异常的原因,比如说是阿里云推送的混淆异常(上图),直接去官网找,有一些就需要摸索了。
自行解决混淆问题参考:-dontwarn com.xx.bbb.**-keep class com.xx.bbb.** { *;}# -keep interface com.xx.bbb.** { *;}
测试
当通过build工具,已经可以生产release版本APK,这说明我们已经初步达成~
接下来,使用混淆的版本运行即可,只要正常运行不发生崩溃就没什么问题了。buildTypes { debug { buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "ENVIRONMENT_BETA", "true" minifyEnabled true//混淆 multiDexEnabled true//分包 65535 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } release { buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "ENVIRONMENT_BETA", "true" minifyEnabled true//混淆 multiDexEnabled true//分包 65535 shrinkResources true//资源缩减 zipAlignEnabled true//Zipalign优化->数据对齐->更快速调用APP内资源 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } android.applicationVariants.all { //版本名称 variant -> generateAppName(variant) } }
如图,把debug版本也设置上混淆,直接运行查看即可。
转载地址:https://blog.csdn.net/weixin_35691921/article/details/109494526 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
网站不错 人气很旺了 加油
[***.192.178.218]2023年12月05日 01时44分20秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
File文件工具类
2019-03-28
Base64编码及其原理
2019-03-28
Java 之 MD5 / SHA系列
2019-03-28
MAC系列算法
2019-03-28
Sring系列之SpringFactoriesLoader详解
2019-03-28
Redis 如何分析慢查询操作?
2019-03-28
学习网站收集
2019-03-28
Linux之CentOS命令
2019-03-28
正则表达式使用记录
2019-03-28
Java之RSA,RSA签名,AES
2019-03-28
开发环境搭建
2019-03-28
JavaScript高级程序设计第四版学习--第三章--第一部分
2019-03-28
JavaScript高级程序设计第四版学习--第三章--第二部分
2019-03-28
JavaScript高级程序设计第四版学习--第三章--第三部分
2019-03-28
JavaScript高级程序设计第四版学习--第四章
2019-03-28
JavaScript高级程序设计第四版学习--第五章
2019-03-28
JavaScript高级程序设计第四版学习--第六章
2019-03-28
JavaScript高级程序设计第四版学习--第七章
2019-03-28
JavaScript高级程序设计第四版学习--第八章
2019-03-28
JavaScript高级程序设计第四版学习--第九章
2019-03-28