Android混淆冲突正确解决姿势
背景
话说有一天,客户说用了你们混淆过的aar库,发现与别人的另一个库冲突了,都存在a.a.a.b.a类,让你赶紧修改,经过一顿面向搜索引擎编程,你发现通过自定义混淆字典可以解决问题,就像下面这样;

其中class_dictionary.txt文件可能是这样的:
//package_dicitonary.txt
# This obfuscation dictionary contains reserved Java keywords. They can't
# be used in Java source files, but they can be used in compiled class files.
# Note that this hardly improves the obfuscation. Decent decompilers can
# automatically replace reserved keywords, and the effect can fairly simply be
# undone by obfuscating again with simpler names.
# Usage:
# java -jar proguard.jar ..... -obfuscationdictionary filename.txt
#ju
ly
is
a
fantastic
month
and
al
ov
ely
girl
你原本想着半天搞定,没想到十分钟就搞定了,顺手就将新的aar库丢给了客户,心中暗喜,接下来劳资可以摸鱼一整天了;没出两分钟,对方顺手就甩你一个bug:
> Task :fpvdemo:minifyReleaseWithR8 FAILED
AGPBI: {"kind":"error","text":"java.nio.file.NoSuchFileException: C:\\Users\\xxxxxxx\\.gradle\\caches\\transforms-2\\files-2.1\\75131363c84dga13bdfer09e2d223de0\\xxxlib\\.\\dictionary\\default_dictionary.txt","sources":[{"file":"C:\\Users\\xxxxxxx\\.gradle\\caches\\transforms-2\\files-2.1\\75131363c84dga13bdfer09e2d223de0\\xxxlib\\.\\dictionary\\default_dictionary.txt"}],"tool":"R8"}
你心想不可能呀,这么简单的东西,是不是他不会用,但本着甲方为大的原则,还是在demo里面跑一跑试试,混淆不开启没问题,混淆一开启,哎呀,还真翻车了,出现同样的问题:
> Task :fpvdemo:minifyReleaseWithR8 FAILED
AGPBI: {"kind":"error","text":"java.nio.file.NoSuchFileException: C:\\Users\\xxxxxxx\\.gradle\\caches\\transforms-2\\files-2.1\\52131363c840aa13bdf7509e2d2e8de0\\xxxlib\\.\\dictionary\\default_dictionary.txt","sources":[{"file"
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
