4

At the moment I am trying to setup a maven build for my existing Android application. (had been built with Ant before) While running the proguard obfuscation I am getting 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
...

The missing references are from the org.apache.http package. I thought that they should be included in the android.jar. I am using the android-maven-plugin version 3.2.0. The following android dependency is defined in the pom.xml.

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

I have installed the Android dependencies with the maven-android-sdk-deployer.

What is the correct solution for this kind of error? Without obfuscation the build is successful and the resulting APK works perfectly fine. I haven't changed the proguard config file. (it worked in combination with ant)

j0k
  • 22,600
  • 28
  • 79
  • 90
denis
  • 1,393
  • 3
  • 14
  • 34

1 Answers1

1

I once had the same problem with Proguard obfuscation when I tried to obfuscate an application which implemented the com.sun.mail package. I got several warnings that Proguard couldn't find referrenced classes from within this library (package).

As a solution, I just surpressed the warnings with the following line: -dontwarn com.sun.**. Everything went well, all classes and functions of the com.mail.sun library worked like a charm in the deployed application and Proguard wasn't complaining about it anymore ;)

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

herom
  • 2,532
  • 29
  • 41