3

When i debug my app it is working fine but when i try to export my apk and install it i am getting this issue:

java.lang.NoClassDefFoundError: org.apache.http.params.SyncBasicHttpParams
at aig.a(Unknown Source)
at ahy.q(Unknown Source)
at ahy.d(Unknown Source)
at ahy.r(Unknown Source)
at ahy.c(Unknown Source)
at ahy.a(Unknown Source)
at ahy.a(Unknown Source)
at ahy.execute(Unknown Source)
at com.application.Login.a(Unknown Source)
at com.application.Login.onCreate(Unknown Source)
at android.app.Activity.performCreate(Activity.java:5115)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2248)
at android.app.ActivityThread.access$600(ActivityThread.java:145)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5095)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)

I am using proguard,

I have added reference libs also like this:

-libraryjars /libs/org.apache.httpcomponents.httpclient_4.2.1.jar
-libraryjars /libs/signpost-commonshttp4-1.2.1.1.jar
-libraryjars /libs/signpost-core-1.2.1.1.jar
-libraryjars /libs/signpost-jetty6-1.2.1.1.jar
-libraryjars /libs/twitter4j-core-2.1.6.jar

any idea..@thanks

Janmejoy
  • 2,721
  • 1
  • 20
  • 38
  • 1
    http://stackoverflow.com/a/18246887/2624806 can help you here. – CoDe Jan 31 '14 at 11:45
  • 1
    n mostly it can related with wrong lib jar file ur using, check here http://stackoverflow.com/a/10423230/2624806 – CoDe Jan 31 '14 at 11:56

4 Answers4

2

Add the following lines to you proguard-project.txt file:

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

I would also suggest you to use repackaged version of HttpClient for Android instead of original HttpClient jar to avoid class loading collisions with the version bundled with Android. But as far as I can see you'll also need to rebuild Signpost HttpClient module to use ch.boye.httpclientandroidlib package instead of org.apache.http (and don't forget to update package name in proguard-project.txt as well).

Volo
  • 28,673
  • 12
  • 97
  • 125
2

There is no HttpCore in your libs.

Please import HttpCore

This link is HttpCore 4.1, You can search HttpCore 4.2 or 4.3 if you want.

In the future, when you import a library please ensure that you import the relevant library

Luc
  • 2,800
  • 2
  • 25
  • 46
  • i have used HttpCore in libs and exported too ..seems its not working,,same issue – Janmejoy Feb 01 '14 at 07:16
  • 1
    I think you should download http components in this link and add to your libs. http://hc.apache.org/downloads.cgi – Luc Feb 01 '14 at 13:28
1

Import the package on your bundle

Import-Package: org.apache.http.params
Linga
  • 10,379
  • 10
  • 52
  • 104
1

In the standard Android builds (Ant, Eclipse, Gradle), don't specify -libraryjars or -injars, since the build scripts will already specify those for you. Just make sure you add all necessary library jars to the libs directory, as usual, so the build scripts will include them.

In Eclipse, libraries may need to be marked as Exported.

Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106