因为混淆的问题生成Release版本失败
发布日期:2021-05-10 05:21:52
浏览次数:24
分类:技术文章
本文共 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 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
关注你微信了!
[***.104.42.241]2024年10月25日 21时32分52秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
Hive记录-Sqoop常用命令
2019-06-11
手写事件代理函数 (Delegated function)
2019-06-11
test1
2019-06-11
(转载)面试题收集——Java基础部分(一)
2019-06-11
Java泛型中的? super T语法
2019-06-11
SSH框架学习步骤
2019-06-11
#if (DEBUG)
2019-06-11
HDU 6140 Hybrid Crystals
2019-06-11
理解urllib、urllib2及requests区别及运用
2019-06-11
wpf enum绑定到comcobox控件
2019-06-11
写一个singleton
2019-06-11
ClosureTemplates(1-2):从Yaya说起
2019-06-11
CSS 实现隐藏滚动条同时又可以滚动
2019-06-11
PHP安全性
2019-06-11
sql server 数据库连接字段解析
2019-06-11
java并发面试常识之copyonwrite
2019-06-11
历届试题 大臣的旅费
2019-06-11