How to not obfuscate interface methods & its parameters using Proguard in Android?

别等时光非礼了梦想. 提交于 2019-12-03 10:44:55

You could keep method's arguments by adding extra flags to -keepattributes. They look like this:

-keepattributes LocalVariableTable,LocalVariableTypeTable

Unfortunately, this keeps arguments from obfuscation not only in the interface you want, but in the entire project. Maybe that's fine for you.

If you're using a default proguard configuration shipped along with Android SDK then you could also use a special annotation to prevent some classes from obfuscation. Check it out.

ProGuard uses the naming convention of Java bytecode, as seen in class file names and stacktraces. Therefore:

-keep public interface com.somepackage.SomeClass$someInterface {*;}

In case if your interface is not public.

-keep interface com.somepackage.SomeClass$someInterface {*;}.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!