0
java.lang.NoClassDefFoundError發生在第一行:NoClassDefFoundError的發生而引發片段
FirstFragment firstTab = FirstFragment.newInstance(10);
mTabsAdapter.addTab(generateTabSpec(0, mTabHost),
firstTab.getClass(), null);
但我敢肯定的片段存在! (這是一個片段,所以不需要檢查是否在Manifest中聲明)。即使重構其名稱或移動到其他包也沒有解決問題。這裏的堆棧跟蹤:
ERROR/AndroidRuntime(23608): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: dev.twothree.android.wtf.FirstFragment
at dev.twothree.android.activity.FragmentTab.setupTabHost(FragmentTab.java:110)
at dev.twothree.android.activity.FragmentTab.onCreate(FragmentTab.java:75)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2136)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2207)
at android.app.ActivityThread.access$600(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4899)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
at dalvik.system.NativeStart.main(Native Method)
它是一個Intell J 12.0.4的bug嗎?我的版本是Build#IC-123.169。後來我會在Eclipse中嘗試它,但仍然希望它可以在Intelli J.中解決。