Reputation: 21076
I built a release version of my app and then decided I wanted to use ProGuard. I added the following to my project.properties file:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt
When I try to build a release version, I get the following errors:
[2012-11-28 17:47:37 - MyApp] Proguard returned with error code 1. See console
[2012-11-28 17:47:37 - MyApp] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2012-11-28 17:47:37 - MyApp] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2012-11-28 17:47:37 - MyApp] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2012-11-28 17:47:37 - MyApp] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2012-11-28 17:47:37 - MyApp] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2012-11-28 17:47:37 - MyApp] Warning: there were 5 unresolved references to classes or interfaces.
[2012-11-28 17:47:37 - MyApp] You may need to specify additional library jars (using '-libraryjars').
[2012-11-28 17:47:37 - MyApp] java.io.IOException: Please correct the above warnings first.
[2012-11-28 17:47:37 - MyApp] at proguard.Initializer.execute(Initializer.java:321)
[2012-11-28 17:47:37 - MyApp] at proguard.ProGuard.initialize(ProGuard.java:211)
[2012-11-28 17:47:37 - MyApp] at proguard.ProGuard.execute(ProGuard.java:86)
[2012-11-28 17:47:37 - MyApp] at proguard.ProGuard.main(ProGuard.java:492)
This is clearly referencing the signpost libraries I am using. I believe I have added the required jars and libraries correctly, but I guess not?
I added the signpost jars via the "Add External JARs..." button, and added the commons-codec library via the "Add External Class Folder..." button.
What am I doing wrong here?
UPDATE:
I added a file called proguard-project.txt to the project's root.
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
Inside the proguard-project.txt file, I added the following:
-keep class org.apache.** { *; }
-keep class oauth.signpost.** { *; }
I am still receiving the same errors.
Upvotes: 0
Views: 1291
Reputation: 16209
I don't know the explanation, but I had the same problem with the guava libraries, having exactly this same warning message. I fixed it by doing this:
-dontwarn com.google.common.collect.MinMaxPriorityQueue
Also with AdMob classes. Same thing. So, perhaps you could do the same:
-dontwarn org.apache.commons.codec.binary.Base64
Since you're succesfully using those classes in your code already.
Warning: since I don't know exactly what this does, proceed with caution and possibly try reading about it.
Upvotes: 1
Reputation: 7478
Probably need to tell proguard to not mess with those classes in your proguard.cfg
-keep class org.apache.** { *; }
-keep class oauth.signpost.** { *; }
Upvotes: 0