我自己的类中的ClassDefNotFoundError

时间:2012-07-14 00:05:15

标签: android noclassdeffounderror android-2.3-gingerbread

我在Eclipse中开发了该项目,然后转移到IntelliJ IDEA CE 12,然后移回Eclipse。 IDEA没有正确地将它转换为eclipse项目,因此我从现有源导入项目并添加了行

<nature>com.android.ide.eclipse.adt.AndroidNature</nature>

到该部分。好的,它编译成功,但是为我编写的类生成了很多奇怪的错误然后崩溃。

LogCat输出:

E/dalvikvm( 9673): Could not find class 'com.capsule.launcher.views.Screen', referenced from method com.capsule.launcher.views.Workspace$1.onPageSelected
W/dalvikvm( 9673): VFY: unable to resolve check-cast 458 (Lcom/capsule/launcher/views/Screen;) in Lcom/capsule/launcher/views/Workspace$1;
D/dalvikvm( 9673): VFY: replacing opcode 0x1f at 0x0010
W/dalvikvm( 9673): Unable to resolve superclass of Lcom/capsule/launcher/views/CellLayout; (346)
W/dalvikvm( 9673): Link of class 'Lcom/capsule/launcher/views/CellLayout;' failed
W/dalvikvm( 9673): Unable to resolve superclass of Lcom/capsule/launcher/views/DockBar; (455)
W/dalvikvm( 9673): Link of class 'Lcom/capsule/launcher/views/DockBar;' failed
W/dalvikvm( 9673): VFY: unable to find class referenced in signature (Lcom/capsule/launcher/views/DockBar;)
W/dalvikvm( 9673): Unable to resolve superclass of Lcom/capsule/launcher/views/CellLayout; (346)
W/dalvikvm( 9673): Link of class 'Lcom/capsule/launcher/views/CellLayout;' failed
W/dalvikvm( 9673): Unable to resolve superclass of Lcom/capsule/launcher/views/DockBar; (455)
W/dalvikvm( 9673): Link of class 'Lcom/capsule/launcher/views/DockBar;' failed
E/dalvikvm( 9673): Could not find class 'com.capsule.launcher.views.DockBar', referenced from method com.capsule.launcher.views.WorkspaceHolder.onLayout
W/dalvikvm( 9673): VFY: unable to resolve instanceof 456 (Lcom/capsule/launcher/views/DockBar;) in Lcom/capsule/launcher/views/WorkspaceHolder;
D/dalvikvm( 9673): VFY: replacing opcode 0x20 at 0x001b
D/AndroidRuntime( 9673): Shutting down VM
W/dalvikvm( 9673): threadid=1: thread exiting with uncaught exception (group=0x40d6e300)
E/AndroidRuntime( 9673): FATAL EXCEPTION: main
E/AndroidRuntime( 9673): java.lang.NoClassDefFoundError: com.capsule.launcher.views.DockBar
E/AndroidRuntime( 9673):    at com.capsule.launcher.LauncherActivity.createWorkspace(LauncherActivity.java:116)
E/AndroidRuntime( 9673):    at com.capsule.launcher.LauncherActivity.onCreate(LauncherActivity.java:58)
E/AndroidRuntime( 9673):    at android.app.Activity.performCreate(Activity.java:5008)
E/AndroidRuntime( 9673):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
E/AndroidRuntime( 9673):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
E/AndroidRuntime( 9673):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
E/AndroidRuntime( 9673):    at android.app.ActivityThread.access$600(ActivityThread.java:130)
E/AndroidRuntime( 9673):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
E/AndroidRuntime( 9673):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 9673):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 9673):    at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime( 9673):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 9673):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 9673):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime( 9673):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 9673):    at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  301):   Force finishing activity com.capsule.launcher/.LauncherActivity
D/dalvikvm( 9673): GC_CONCURRENT freed 4207K, 20% free 19381K/23943K, paused 13ms+4ms, total 52ms
W/ActivityManager(  301): Activity pause timeout for ActivityRecord{418f0cd0 com.capsule.launcher/.LauncherActivity}
D/dalvikvm(  301): GC_CONCURRENT freed 1886K, 28% free 22076K/30279K, paused 4ms+9ms, total 99ms
W/ActivityManager(  301): Activity destroy timeout for ActivityRecord{418f0cd0 com.capsule.launcher/.LauncherActivity}
D/Finsky  ( 7843): [1] 5.onFinished: Installation state replication succeeded.

之前它在IDEA和Eclipse中运行良好!

6 个答案:

答案 0 :(得分:4)

我不知道您的项目发生了什么,但尝试使用Eclipse:Project - &gt;清洁 - &GT; YourProject

答案 1 :(得分:3)

在Eclipse中清理和构建项目。如果使用其包名正确定义了启动器活动,还要检查Android清单文件。

答案 2 :(得分:2)

使用它(手动)并不是一个好主意,而是我们可以通过简单的步骤将项目从IntelliJ IDEA导出到Eclipse。

请遵循以上标准文件。

http://www.jetbrains.com/idea/webhelp/exporting-intellij-idea-project-to-eclipse.html

希望这会对你有所帮助。

答案 3 :(得分:2)

如果您在项目中使用库,请尝试在构建路径中添加库导出

答案 4 :(得分:1)

如果你确实有旧的工作eclipse项目,那么从IntelliJ IDEA项目中复制/替换所有新的代码和jar。请记住仅复制/替换代码和jar而不是IntelliJ IDEA特定的设置文件。

答案 5 :(得分:0)

右键单击有问题的项目并选择属性 选择适当的Android版本(使用google api 1.1,1.5或1.5)并说好 再次右键单击项目并选择“Android Tools&gt; Fix Project Properties”
修复导入一次(如果需要)
刷新项目,您应该准备就绪,无需任何手动编辑

希望这有帮助。