2

While exporting my Android Application from Eclipse IDE, I am getting errors as below:

Proguard returned with error code 1. See console
Warning: library class android.net.http.AndroidHttpClient extends or implements program class org.apache.http.client.HttpClient
       You should check if you need to specify additional program jars.
Warning: there were 1 instances of library classes depending on program classes.
          You must avoid such dependencies, since the program classes will
          be processed, while the library classes will remain unchanged.
java.io.IOException: Please correct the above warnings first.
    at proguard.Initializer.execute(Initializer.java:321)
    at proguard.ProGuard.initialize(ProGuard.java:211)
    at proguard.ProGuard.execute(ProGuard.java:86)
    at proguard.ProGuard.main(ProGuard.java:492)

project.properties

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:proguard-google-api-client.txt

# Project target.
target=android-21

proguard-project

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}
-dontwarn com.google.android.gms.**
-dontwarn javax.jdo.**
-dontwarn com.google.api.client.googleapis.extensions.android.gms.**
-dontwarn org.apache.commons.**
-dontwarn org.ietf.jgss.**
-dontnote

I have added dontwarn and dontnote statements to proguard confing file with that I resolved few warnings but Not able to solve remaining issue.Please help me to solve this.Thanks you.

AndyN
  • 1,742
  • 1
  • 15
  • 30

5 Answers5

3

You Just need to add below code to your project's proguard-project.txt file.

-dontwarn ["error package name or Error file path here"]

example as :

-dontwarn com.example.media.*

and if you have more(insane) errors coming, then just add

-dontskipnonpubliclibraryclassmembers

May be this helpful for you.

1

Add this to Your proguard-project file:

  -keep class org.apache.http.** { *; }
  -dontwarn org.apache.http.*

Then come back if still errors exists.

Opiatefuchs
  • 9,800
  • 2
  • 36
  • 49
1

please used comments before the given code bellow proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:proguard-google-api-client.txt

In project.properties file

Hemant
  • 81
  • 1
  • 3
  • used comments if your proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:proguard-google-api-client.txt – Hemant Apr 08 '15 at 08:58
0

I also have faced this problem. Cleaning the project and exporting again should fix this.

Fahim
  • 12,198
  • 5
  • 39
  • 57
0

As the issue was due to library class android.net.http.AndroidHttpClient and org.apache.http.client.HttpClient, I added -dontwarn statements for both the library classes to proguard-project file. what I added is:

-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.*
-dontwarn android.net.http.*

and I am done. Thank you all for helping out on this.

AndyN
  • 1,742
  • 1
  • 15
  • 30