ClassNotFoundException:找不到类:但Class是Exist

时间:2012-12-09 17:46:48

标签: android eclipse classnotfoundexception buildpath

我在我的应用程序中发现了ClassNotFoundException,但是Class已经存在..这是项目工作区

我正在处理很多图书馆, 但是在创建构建路径和依赖时我遇到了问题。

Logcat Show Msgs:

12-10 00:36:56.840: W/System.err(12666): java.lang.ClassNotFoundException: Could not find class: org.holoeverywhere.internal.AlertController.RecycleListView
12-10 00:36:56.845: W/System.err(12666):    at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:318)
12-10 00:36:56.845: W/System.err(12666):    at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:325)
12-10 00:36:56.845: W/System.err(12666):    at org.holoeverywhere.LayoutInflater$HoloFactoryMerger.onCreateView(LayoutInflater.java:63)
12-10 00:36:56.845: W/System.err(12666):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:660)
12-10 00:36:56.845: W/System.err(12666):    at android.view.LayoutInflater.inflate(LayoutInflater.java:457)
12-10 00:36:56.845: W/System.err(12666):    at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:278)
12-10 00:36:56.845: W/System.err(12666):    at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
12-10 00:36:56.845: W/System.err(12666):    at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:263)
12-10 00:36:56.845: W/System.err(12666):    at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:258)
12-10 00:36:56.845: W/System.err(12666):    at org.holoeverywhere.internal.AlertController$AlertParams.createListView(AlertController.java:144)
12-10 00:36:56.845: W/System.err(12666):    at org.holoeverywhere.internal.AlertController$AlertParams.apply(AlertController.java:130)
12-10 00:36:56.845: W/System.err(12666):    at org.holoeverywhere.app.AlertDialog$Builder.create(AlertDialog.java:41)
12-10 00:36:56.845: W/System.err(12666):    at org.isolaa.droidquiz.DashboardActivity$QuizFragment.onItemLongClick(DashboardActivity.java:455)
12-10 00:36:56.850: W/System.err(12666):    at android.widget.AbsListView.performLongPress(AbsListView.java:2703)
12-10 00:36:56.850: W/System.err(12666):    at android.widget.AbsListView$CheckForLongPress.run(AbsListView.java:2651)
12-10 00:36:56.850: W/System.err(12666):    at android.os.Handler.handleCallback(Handler.java:587)
12-10 00:36:56.850: W/System.err(12666):    at android.os.Handler.dispatchMessage(Handler.java:92)
12-10 00:36:56.850: W/System.err(12666):    at android.os.Looper.loop(Looper.java:132)
12-10 00:36:56.850: W/System.err(12666):    at android.app.ActivityThread.main(ActivityThread.java:4123)
12-10 00:36:56.850: W/System.err(12666):    at java.lang.reflect.Method.invokeNative(Native Method)
12-10 00:36:56.850: W/System.err(12666):    at java.lang.reflect.Method.invoke(Method.java:491)
12-10 00:36:56.850: W/System.err(12666):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
12-10 00:36:56.855: W/System.err(12666):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
12-10 00:36:56.855: W/System.err(12666):    at dalvik.system.NativeStart.main(Native Method)
12-10 00:36:56.855: W/System.err(12666): android.view.InflateException: Binary XML file line #2: Error inflating class org.holoeverywhere.internal.AlertController.RecycleListView
12-10 00:36:56.855: W/System.err(12666):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682)
12-10 00:36:56.855: W/System.err(12666):    at android.view.LayoutInflater.inflate(LayoutInflater.java:457)
12-10 00:36:56.855: W/System.err(12666):    at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:278)
12-10 00:36:56.855: W/System.err(12666):    at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
12-10 00:36:56.855: W/System.err(12666):    at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:263)
12-10 00:36:56.855: W/System.err(12666):    at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:258)
12-10 00:36:56.855: W/System.err(12666):    at org.holoeverywhere.internal.AlertController$AlertParams.createListView(AlertController.java:144)
12-10 00:36:56.860: W/System.err(12666):    at org.holoeverywhere.internal.AlertController$AlertParams.apply(AlertController.java:130)
12-10 00:36:56.860: W/System.err(12666):    at org.holoeverywhere.app.AlertDialog$Builder.create(AlertDialog.java:41)
12-10 00:36:56.860: W/System.err(12666):    at org.isolaa.droidquiz.DashboardActivity$QuizFragment.onItemLongClick(DashboardActivity.java:455)
12-10 00:36:56.860: W/System.err(12666):    at android.widget.AbsListView.performLongPress(AbsListView.java:2703)
12-10 00:36:56.860: W/System.err(12666):    at android.widget.AbsListView$CheckForLongPress.run(AbsListView.java:2651)
12-10 00:36:56.860: W/System.err(12666):    at android.os.Handler.handleCallback(Handler.java:587)
12-10 00:36:56.860: W/System.err(12666):    at android.os.Handler.dispatchMessage(Handler.java:92)
12-10 00:36:56.860: W/System.err(12666):    at android.os.Looper.loop(Looper.java:132)
12-10 00:36:56.860: W/System.err(12666):    at android.app.ActivityThread.main(ActivityThread.java:4123)
12-10 00:36:56.860: W/System.err(12666):    at java.lang.reflect.Method.invokeNative(Native Method)
12-10 00:36:56.865: W/System.err(12666):    at java.lang.reflect.Method.invoke(Method.java:491)
12-10 00:36:56.865: W/System.err(12666):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
12-10 00:36:56.865: W/System.err(12666):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
12-10 00:36:56.865: W/System.err(12666):    at dalvik.system.NativeStart.main(Native Method)
12-10 00:36:56.865: W/System.err(12666): Caused by: java.lang.ClassNotFoundException: org.holoeverywhere.internal.AlertController.RecycleListView in loader dalvik.system.PathClassLoader[/data/app/org.isolaa.droidquiz-1.apk]
12-10 00:36:56.870: W/System.err(12666):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251)
12-10 00:36:56.870: W/System.err(12666):    at java.lang.ClassLoader.loadClass(ClassLoader.java:540)
12-10 00:36:56.870: W/System.err(12666):    at java.lang.ClassLoader.loadClass(ClassLoader.java:500)
12-10 00:36:56.870: W/System.err(12666):    at android.view.LayoutInflater.createView(LayoutInflater.java:542)
12-10 00:36:56.870: W/System.err(12666):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:671)
12-10 00:36:56.870: W/System.err(12666):    ... 20 more

1 个答案:

答案 0 :(得分:0)

确保,如果您正在使用eclipse,则会在构建路径中配置它们。这样它就包含在APK中了。此外,由于ADB如何传输文件,您的DroidQuiz.apk将变为DroidQuiz-1.apk。你称之为apk并不重要,它会做同样的事情。