我使用ProGuard的混淆我的android应用。 Android应用包含了一些本地的code,这使得回调完全合格的Java方法。我需要不混淆这些类和它们的方法的名称。下面适当地保持的类名称,而不是方法名。
-keep公共类com.me.dontobf。*
-keepnames公共类com.me.dontobf。*
解决方案
有关本地方法: ProGuard的手册>例子>处理本地方法
-keepclasseswithmembernames类* {
天然的LT;方法&gt ;;
}
![植物名实图考木类附录 放蜡法 一厚册,宽博阔绰 雕刻精雅,棉纸精印,内容独具](/d/file/2023/09-17/cf11f145bf03b7c99a6da5018435796e.png)
在这种情况下,回调方法: ProGuard的手册>例子>处理回调方法
-keep类mypackage.MyCallbackClass {
无效myCallbackMethod(java.lang.String中);
}
或者,例如,如果所有的公有方法可能会回调方法:
-keep类mypackage.MyCallbackClass {
公共和LT;方法&gt ;;
}
您可能还需要保持发生在方法描述的任何程序类。
I am using proguard to obfuscate my android application. The android application contains some native code, which makes callbacks to fully qualified java methods. I need to not obfuscate these classes and the names of their methods. The below properly keeps the class names, but not the method names.
-keep public class com.me.dontobf.*
-keepnames public class com.me.dontobf.*
解决方案
For native methods: ProGuard manual > Examples > Processing native methods
-keepclasseswithmembernames class * {
native <methods>;
}
In this case, for callback methods: ProGuard manual > Examples > Processing callback methods
-keep class mypackage.MyCallbackClass {
void myCallbackMethod(java.lang.String);
}
Or e.g., if all public methods may be callback methods:
-keep class mypackage.MyCallbackClass {
public <methods>;
}
You probably also need to keep any program classes that occur in the method descriptors.
相关推荐
最新文章