Android - Maven Build - Proguard - cannot find reference class

I'm currently trying to set up a maven build for my existing Android application. (previously built with Ant). When I run obfuscation proguard, I get a lot of warnings telling me the following:

... can't find referenced class org.apache.http.params.BasicHttpParams can't find referenced class org.apache.http.params.BasicHttpParams can't find referenced class org.apache.http.params.HttpConnectionParams can't find referenced class org.apache.http.params.HttpConnectionParams can't find referenced class org.apache.http.impl.client.DefaultHttpClient can't find referenced class org.apache.http.impl.client.DefaultHttpClient can't find referenced class org.apache.http.impl.client.DefaultHttpClient can't find referenced class org.apache.http.auth.AuthScope can't find referenced class org.apache.http.auth.AuthScope can't find referenced class org.apache.http.auth.UsernamePasswordCredentials ... 

Missing links from org.apache.http package. I thought they should be included in android.jar. I am using android-maven-plugin version 3.2.0. Pom.xml defines a specific dependency on android.

 <dependency> <groupId>android</groupId> <artifactId>android</artifactId> <version>4.0.3_r3</version> <scope>provided</scope> </dependency> 

I installed Android dependencies using maven-android-sdk-deployer.

What is the right solution for this kind of error? Without obfuscation, the build is successful, and the resulting APK works fine. I have not changed the proguard configuration file. (he worked in combination with ant)

+4
source share
1 answer

I had the same problem with Obguard obfuscation when I tried to confuse an application that implemented the com.sun.mail package. I had several warnings that Proguard could not find the reference classes from this library (package).

As a solution, I simply clicked on the warnings with the following line: -dontwarn com.sun.** . Everything went well, all the classes and functions of the com.mail.sun library worked like a charm in a deployed application, and Proguard no longer complained about it;)

So, in your case, you add the line: -dontwarn org.apache.**

+1
source

All Articles