I've just finished creating an Android app that requires the Dropbox.com API libraries. I'm now trying to build the application in 'Release' mode and would like to run proguard on the code in order to obfuscate it. However, whenever I attempt to run Proguard, I get the following error:
Proguard returned with error code 1. See console
Warning: com.dropbox.client2.DropboxAPI: can't find referenced class org.json.simple.JSONArray
Warning: com.dropbox.client2.DropboxAPI: can't find referenced class org.json.simple.JSONArray
Warning: com.dropbox.client2.DropboxAPI$Entry: can't find referenced class org.json.simple.JSONArray
Warning: com.dropbox.client2.DropboxAPI$Entry: can't find referenced class org.json.simple.JSONArray
Warning: com.dropbox.client2.RESTUtility: can't find referenced class org.json.simple.parser.JSONParser
Warning: com.dropbox.client2.RESTUtility: can't find referenced class org.json.simple.parser.JSONParser
Warning: com.dropbox.client2.RESTUtility: can't find referenced class org.json.simple.parser.JSONParser
Warning: com.dropbox.client2.RESTUtility: can't find referenced class org.json.simple.parser.ParseException
Warning: there were 8 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars'),
or perhaps the '-dontskipnonpubliclibraryclasses' option.
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:308)
at proguard.ProGuard.initialize(ProGuard.java:210)
at proguard.ProGuard.execute(ProGuard.java:85)
at proguard.ProGuard.main(ProGuard.java:499)
I'm already including the '-dontskipnonpubliclibraryclasses' option and that's not helping me at all. I tried including the '-libraryjars' option, though, I may have been using it incorrectly as I'm not really sure how I'm intended to use that flag.
Does anyone have any ideas how I can correct this error? Right now, I'm unable to build my application while running it through Proguard. Any help is appreciated! Thanks!
Cfr. ProGuard manual > Troubleshooting > Warning: can't find referenced class
com.dropbox seems to depend on org.json. In theory, you should therefore add the org.json jar to your libs directory, so it can be processed and included in your application. In practice, your application works fine without it, so you can let ProGuard ignore the missing dependency:
-dontwarn org.json.**
or
-dontwarn com.dropbox.**
You shouldn't add -libraryjars, because any jars that you specify won't be present on Android devices unless you'd somehow manage to install them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With