Reputation: 3300
I am working on an app and released 2 updates previously. From the beginning I have been using Jsoup for my work and every thing seemed to be just fine.
Needing to do some update, I worked on the app and for my surprise I got NoClassDefFoundError exception with regards to Jsoup.
04-14 20:24:57.256: E/AndroidRuntime(806): java.lang.NoClassDefFoundError: org.jsoup.Jsoup
After going through few suggestions, I cleaned the project. Removed the library and re-imported it. Made a lib folder, copied the library there, then imported it to the project. Deleted the bin folder. Tried obtaining the latest version of Jsoup but nothing seemed to work.
Then I checked the APK file. The previous release was about 350kb in size. But this was just above 200kb in size and I did nothing for the size of it to go down.
NoClassFound, well it means there is no class, but what is this NoClassdefFoundError? Does it mean the library is actually there and some thing is not right?
Here is the line that uses Jsoup just before it dooms.
ua.setDescription(Jsoup.parse(content.replace("<br>", "[newline]")).text().replace("[newline]", "\n"));
Here content is a String.
What could be happening, what am I doing wrong? Any suggestion? Thanks in advance.
Total Error from logcat is as follows, which I don't think will be of much use:
04-14 20:24:57.256: E/AndroidRuntime(806): FATAL EXCEPTION: MagentoBackground
04-14 20:24:57.256: E/AndroidRuntime(806): java.lang.NoClassDefFoundError: org.jsoup.Jsoup
04-14 20:24:57.256: E/AndroidRuntime(806): at com.mozeej.android.lankafriends.datastructures.UserAccountParser.parseHTML_LankaLove(UserAccountParser.java:89)
04-14 20:24:57.256: E/AndroidRuntime(806): at com.mozeej.android.lankafriends.BrowseView.loadProfiles(BrowseView.java:201)
04-14 20:24:57.256: E/AndroidRuntime(806): at com.mozeej.android.lankafriends.BrowseView.getUsers(BrowseView.java:229)
04-14 20:24:57.256: E/AndroidRuntime(806): at com.mozeej.android.lankafriends.BrowseView.access$0(BrowseView.java:208)
04-14 20:24:57.256: E/AndroidRuntime(806): at com.mozeej.android.lankafriends.BrowseView$5.run(BrowseView.java:174)
04-14 20:24:57.256: E/AndroidRuntime(806): at java.lang.Thread.run(Thread.java:1019)
04-14 20:24:59.626: E/WindowManager(806): Activity com.mozeej.android.lankafriends.BrowseView has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@406267a8 that was originally added here
04-14 20:24:59.626: E/WindowManager(806): android.view.WindowLeaked: Activity com.mozeej.android.lankafriends.BrowseView has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@406267a8 that was originally added here
04-14 20:24:59.626: E/WindowManager(806): at android.view.ViewRoot.<init>(ViewRoot.java:258)
04-14 20:24:59.626: E/WindowManager(806): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
04-14 20:24:59.626: E/WindowManager(806): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
04-14 20:24:59.626: E/WindowManager(806): at android.view.Window$LocalWindowManager.addView(Window.java:424)
04-14 20:24:59.626: E/WindowManager(806): at android.app.Dialog.show(Dialog.java:241)
04-14 20:24:59.626: E/WindowManager(806): at android.app.ProgressDialog.show(ProgressDialog.java:107)
04-14 20:24:59.626: E/WindowManager(806): at android.app.ProgressDialog.show(ProgressDialog.java:90)
04-14 20:24:59.626: E/WindowManager(806): at com.mozeej.android.lankafriends.BrowseView.onCreate(BrowseView.java:179)
04-14 20:24:59.626: E/WindowManager(806): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-14 20:24:59.626: E/WindowManager(806): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-14 20:24:59.626: E/WindowManager(806): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-14 20:24:59.626: E/WindowManager(806): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-14 20:24:59.626: E/WindowManager(806): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-14 20:24:59.626: E/WindowManager(806): at android.os.Handler.dispatchMessage(Handler.java:99)
04-14 20:24:59.626: E/WindowManager(806): at android.os.Looper.loop(Looper.java:123)
04-14 20:24:59.626: E/WindowManager(806): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-14 20:24:59.626: E/WindowManager(806): at java.lang.reflect.Method.invokeNative(Native Method)
04-14 20:24:59.626: E/WindowManager(806): at java.lang.reflect.Method.invoke(Method.java:507)
04-14 20:24:59.626: E/WindowManager(806): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-14 20:24:59.626: E/WindowManager(806): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-14 20:24:59.626: E/WindowManager(806): at dalvik.system.NativeStart.main(Native Method)
Upvotes: 1
Views: 288
Reputation: 8004
Like Joe said, your jars now MUST be in the libs directory.
Upvotes: 1
Reputation: 2594
This is a problem in the latest Android Developer tools.
Move the jars into < yourappdir with AndroidManifest.xml in >/libs
and it'll work.
I know, it's daft.
Joe
Upvotes: 3