图书馆的Android ProGuard的混淆:保持班级不工作 [英] Android ProGuard obfuscation of library: keep class not working
问题描述
简介:我在AS 1项目,2个型号:
Intro: I have in AS 1 project with 2 models:
- 的Android库项目与一些公共API类
- Android应用程序依赖于上述库(库模块是依赖列表)
任务:我想混淆我的图书馆项目,因为我要揭露它作为公共SDK,但让我的code保护...
Task: I want to obfuscate my library project because I want to expose it as public SDK but keep my code protected...
我做了什么:所以我做了定制ProGuard的规则:
What I did: So I made custom ProGuard rules:
-dontshrink
-dontoptimize
-dontpreverify
-keep class com.org.my_public_api_class_name
我跳过所有其他阶段,以便消除其中的错误是只模糊处理的阶段。
I skip all other stages in order to eliminate where the bug is to only obfuscation stage.
结果:构建应用程序模块的失败,像
Result: Build of the APP module fails with errors like
错误:无法找到符号类my_public_api_class_name
这似乎对我的问题是混淆不会被跳过,我想这个类,所以现在他有一些毫无意义的名字,因此在应用中,我用他的地方,原来的名称不存在。
It seems for me that the problem is that the obfuscation NOT skipped the class I wanted to, so now he has some meaningless name and therefore in the APP, where I'm using him, The original name not exist.
谢谢,
推荐答案
要排除混淆你的类,试试这个:
To exclude your class from obfuscation, try this:
-keep class com.org.my_public_api_class_name**
-keepclassmembers class com.org.my_public_api_class_name** {*;}
这篇关于图书馆的Android ProGuard的混淆:保持班级不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!