1

I have searched on SO for similar questions but didn't find any.So forgive me if I am repeating the question,if any is out there on SO.

I have come across a strange problem.My Indigo eclipse stopped being able to access jar file's classes even though i configured jar correctly and it shows me the list of jars i have added for a project.

Previously it was running perfectly but now I come to this after shifting to Juno eclipse from Indigo eclipse and again back to Indigo.I don't know what's wrong? I am not able to run the application with jar files now.it shows no error but it gives run time exception when my code tries to use class of a jar file.

Please help me to fix this.

Example logcat:

10-05 14:20:15.359: W/dalvikvm(517): threadid=1: thread exiting with uncaught exception (group=0x40015560)
10-05 14:20:15.370: E/AndroidRuntime(517): FATAL EXCEPTION: main
10-05 14:20:15.370: E/AndroidRuntime(517): java.lang.NoClassDefFoundError: twitter4j.http.AccessToken
10-05 14:20:15.370: E/AndroidRuntime(517):  at com.xxx.android.androidtwittersample.TwitterUtils.isAuthenticated(TwitterUtils.java:27)
10-05 14:20:15.370: E/AndroidRuntime(517):  at com.xxx.android.androidtwittersample.AndroidTwitterSample.setVisibilities(AndroidTwitterSample.java:213)
10-05 14:20:15.370: E/AndroidRuntime(517):  at com.xxx.android.androidtwittersample.AndroidTwitterSample.onCreate(AndroidTwitterSample.java:72)
10-05 14:20:15.370: E/AndroidRuntime(517):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-05 14:20:15.370: E/AndroidRuntime(517):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
10-05 14:20:15.370: E/AndroidRuntime(517):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-05 14:20:15.370: E/AndroidRuntime(517):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-05 14:20:15.370: E/AndroidRuntime(517):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-05 14:20:15.370: E/AndroidRuntime(517):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-05 14:20:15.370: E/AndroidRuntime(517):  at android.os.Looper.loop(Looper.java:130)
10-05 14:20:15.370: E/AndroidRuntime(517):  at android.app.ActivityThread.main(ActivityThread.java:3683)

EDIT :

I forgot to be mention that i put my jars in "lib" folder.sorry for the late specification!

Hiral Vadodaria
  • 19,158
  • 5
  • 39
  • 56
  • I think, that the android Plugin is causing this issue. Please can you insure that you are putting all your jars in the libs folder. Can you provide the Android plugin version that you are using? – Anis BEN NSIR Oct 05 '12 at 09:15
  • @Anis: yes..i am putting them in libs only! – Hiral Vadodaria Oct 05 '12 at 09:16
  • Try to update ADT to 20.3 version. All jars will be in build path automatically. Also you have to re-import your project to your workspace using Import Android project, clean the project after that i suppose that all will be fine. – Anis BEN NSIR Oct 05 '12 at 09:20
  • http://stackoverflow.com/a/10046725/1289716 – MAC Oct 05 '12 at 09:28
  • @Anis: sorry,i was "lib" and not "libs" for me.. so that was the only cause and i avoided being specific. thanks for the response! – Hiral Vadodaria Oct 05 '12 at 09:29

3 Answers3

1

Check if all jars are marked in order and export tab: https://i.stack.imgur.com/0w5R6.png

if that doesn't help check out that link: http://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17

1

The jar files need to be placed in /libs in order to work (you also shouldn't need them in the build path as this is now automatic).

This was a change in the ADT, can't remember which one but the rules changed, and very annoyingly eclipse compiles happily both ways - so it appears to be fine but won't actually work on an Android device.

zeetoobiker
  • 2,789
  • 1
  • 18
  • 10
1

Make sure you create the libs not lib directory to store the extra lib for your project. If its lib then rename it to libs and then remove all added jars from library tab and then add new jar with libs path. now run it.

Pratik
  • 30,639
  • 18
  • 84
  • 159