开发者

how to apply proguard on both android project and service project at the same time

I'm trying to use the proguard in my android application, I've wrote all my services in a separate project and package through maven as service jar. I'm using this service jar as dependency in my UI project.

I'm using maven android and proguard-maven开发者_JAVA百科-plugin to build/release my UI project. My question is how to apply Proguard for both project at same time, is it possible to do?

I tried running proguard separately on service project and add that jar to UI project but it's not worked.please guide me to solve this.


You shouldn't run proguard on jar file which are references by your android application (in your particular case, not in general).

Here is how android application is being compiled:

  1. Compile all .java files into .class.
  2. Unzip all jar files and extract .class files from them.
  3. Apply proguard to all .class files (your application's .class files + all jars' .class files).
  4. Convert .class files to dex format which results in classes.dex file

Basically, you shouldn't apply proguard on a jar file that is used by Android Application. If you have to apply proguard, then make sure all classes, interfaces, etc. that are used by your Android Application are not obfuscated by proguard.

I would recommend to just use Android's build system proguard step called -obfuscate. That would be the easiest way to go (and would make your life much easier when crash reports start coming in).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜