如何混淆Jar或AAR文件 [英] How to Obfuscated Jar or AAR files
问题描述
有人可以帮我解决这个问题,或者给我榜样吗?
Can someone help me about, obfuscated or give me example to do this?
我创建了一个.aar
文件和一个.jar
文件,并放置了getter和setter类,如果他们访问它们,它们将提供值.
I created an .aar
file and .jar
file and put the class of getter and setter that will give value if they access on it.
但是需要将隐藏的值放在某人看不到的东西上的东西.
but the thing in need to put the hidden values that someone will not see what is the value on it.
package com.example.test;
public class MyClass extends privateClass{
String testing;
public MyClass() {
this.testing = getStringExample();
}
public String getTesting() {
return testing;
}
public void setTesting(String testing) {
this.testing = testing;
}
}
如果我给我的图书馆,这个类必须对其他开发者隐藏/混淆
and this class must be hide/obfuscated to the other developers if i give my library
package com.example.test;
public class privateClass {
String getStringExample()
{
return "TEST RESULT";
}
}
注意:我也尝试过放置proguard,并检查库,但仍然可以看到我的私有类,我尝试使用interface并扩展了该类,但仍然相同,
Note: I tried to put proguard too, and check the library but still they can see my private class, , i tried to use interface and extends the class but still the same,
这是我的proguard示例:
here is my proguard example:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontwarn ccom.example.test.R*
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class
-keepclassmembers class com.example.test.** { *; }
-keep class com.example.eyefixdata.** {
void set*(***);
void set*(int, ***);
boolean is*();
boolean is*(int);
*** get*();
*** get*(int);
}
请保存我的一天.希望你能帮助我. 预先感谢.
Please save my day. hope you help me. Thanks in advance.
推荐答案
您可以将私有类/接口移至其他包,例如将您的privateClass
放入内部包package com.example.your.library.internal;
中,以区别于您的公共类/接口.
You can move your private classes/interfaces to other packages, e.g. put your privateClass
to an internal package package com.example.your.library.internal;
to distinguish with your public classes/interfaces.
package com.example.your.library.internal;
public class privateClass {
String getStringExample()
{
return "TEST RESULT";
}
}
然后将以下行添加到您的proguard配置中
And add below line to your proguard configuration
-keep public class com.example.your.library.* { public *; }
请注意,您应该使用单个通配符*
不混淆内部软件包.
Note that you should use single wild char *
to NOT obfuscate the internal packages.
这篇关于如何混淆Jar或AAR文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!