我正在开发一款应用,之前发布了2条更新。从一开始我一直在使用Jsoup来完成我的工作,而且每件事情似乎都很好。
需要做一些更新,我在应用程序上工作,令我惊讶的是,我得到了关于Jsoup的NoClassDefFoundError异常。
04-14 20:24:57.256: E/AndroidRuntime(806): java.lang.NoClassDefFoundError: org.jsoup.Jsoup
在完成一些建议后,我清理了项目。删除了库并重新导入它。制作一个lib文件夹,将库复制到那里,然后将其导入项目。删除了bin文件夹。尝试获得最新版本的Jsoup但似乎没有任何效果。
然后我检查了APK文件。之前的版本大小约为350kb。但是这个尺寸刚刚超过200kb,我没有采取任何措施来减小尺寸。
NoClassFound,这意味着没有类,但是这个NoClassdefFoundError是什么?这是否意味着图书馆实际存在并且有些事情不对?
这是在Jsoup出现之前使用Jsoup的行。
ua.setDescription(Jsoup.parse(content.replace("<br>", "[newline]")).text().replace("[newline]", "\n"));
这里的内容是一个字符串。
可能发生什么,我做错了什么?有什么建议吗?提前谢谢。
logcat的总错误如下,我认为这不会有多大用处:
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)
答案 0 :(得分:3)
这是最新的Android开发者工具中的一个问题。
将罐子移到< yourappdir with AndroidManifest.xml in >/libs
,它会起作用。
我知道,这很愚蠢。
乔
答案 1 :(得分:1)
像Joe说的那样,你的罐子现在必须在libs目录中。