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:
- Compile all
.java
files into.class
. - Unzip all jar files and extract
.class
files from them. - Apply proguard to all
.class
files (your application's.class
files + all jars' .class files). - Convert
.class
files todex
format which results inclasses.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).
精彩评论