java - 混淆时如何避免proguard修改包结构
问题描述
我有一个具有以下结构的android库项目:
- com.domain
------------.internal //internal classes of the library
------------.thirdPartyLib //3rd party library package renamed
------------.library.publicclasses //All the public classes of the library
这个想法是将程序配置为:
- Don't remove any unused classes (since it is a library)
- Obfuscate and optimize everything (including class and methods names) except the classes under **publicclasses** that should keep their names and public elements unchanged
目前我的proguard配置是:
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-keep,allowobfuscation class com.domain.** {*;}
-keep class com.domain.library.publicclasses.** {public *;}
-keep class com.domain.library.publicclasses.Foo {public protected *;}
此配置的结果是:
- com.domain.library.publicclasses //All the public classes of the library
- a.a.a /// all the internal and thirdPartyLib classes
我的问题是这些a.a.a
类与其他库混淆的类发生冲突,所以我也希望最终的类结构是
- com.domain.library
--------------------.publicclasses //All the public classes of the library
--------------------.a /// all the internal and thirdPartyLib classes
将混淆的类保留在我的域下,这样它就不会发生冲突。
我怎样才能做到这一点?
解决方案
推荐阅读
- c - x86-64 中的内存分配
- javascript - 如何添加 JS 脚本以在自定义共享点列表中创建“阅读更多”?
- javascript - 简单的 Ember.js `has-many` 关系不起作用
- python - 需要为 Python 3.7.2 IDLE 安装 pip 和 pygame(语法无效)
- c# - datagridview 日期排序 c#
- reactjs - React:如何在 API POST 后重新渲染组件以显示新数据?
- c# - 找不到作为项目一部分的自定义控件
- r - 在 R 中模拟肥尾数据
- xamarin - 尝试在 VS 中存档 Xamarin 项目,出现错误
- javascript - Discord.JS 命令处理程序子文件夹搜索