混淆打包出现IOException解决办法

来源:互联网 发布:博朗剃须刀推荐 知乎 编辑:程序博客网 时间:2024/05/21 09:56

当使用混淆打包时可能会出现一个问题

<code class="hljs applescript has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">Error:Execution failed <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">for</span> task :transformClassesAndResourcesWithProguardForRelease'.> java.io.IOException: Please correct <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">the</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">above</span> warnings <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">first</span>.</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>

这个问题是在说你在混淆打包的时候有些类有可能找不着,所以会包错,和warning 
解决的办法: 
找到报warning的类都给他在你的proguard-rules.pro混淆器文件中 
添加代码-dontwarn 包名+类名.**给取消掉warning就可以了,如果你不想那个类被混淆,那就添加代码:-keep class 包名+类名{*;}或者包名.**{*;}

亲身实践,用以上两个方法就解决了所有错误。

0 0
原创粉丝点击