Android应用。 ClassNotFoundException的

时间:2013-06-18 23:42:37

标签: java android classnotfoundexception

我知道这个异常已经反复讨论过,但不知怎的,我无法解决这个问题。 我前段时间制作了一个应用程序(BeerOrNoBeer Drinkinggame)并将其发布在Google Play商店中,但在我切换到新的笔记本电脑后,我无法使其正常工作。 该应用程序启动进入菜单,甚至进入GameActivity和AboutActivity。但是,当我尝试打开SendBeerBrandActivity或按下OnScreen Backbutton App强制停止..

如果有人可以提供帮助,我会非常感激,所以我终于可以做出期待已久的更新。

我在Github上有整个代码Beer Or No Beer

此功能打开新活动:

public void sendbeer(){
    Intent gosendbeer  = new Intent("com.celticwolf.alex.SENDBRAND");
    startActivity(gosendbeer);
}

这是按下按钮以启动“SendBeerBrand”后的错误日志。

06-18 23:04:39.945: I/dalvikvm-heap(545): Clamp target GC heap from 24.385MB to 24.000MB
06-18 23:04:39.965: D/dalvikvm(545): GC_FOR_ALLOC freed 970K, 7% free 22837K/24391K, paused 50ms
06-18 23:04:48.096: D/ActionBarSherlock(545): [dispatchOptionsItemSelected] item: Rate this App
06-18 23:04:48.096: D/ActionBarSherlock(545): [callbackOptionsItemSelected] item: Rate this App
06-18 23:04:48.146: D/ActionBarSherlock(545): [callbackOptionsItemSelected] returning true
06-18 23:04:48.146: D/ActionBarSherlock(545): [dispatchOptionsItemSelected] returning true
06-18 23:11:04.362: D/AndroidRuntime(545): Shutting down VM
06-18 23:11:04.362: W/dalvikvm(545): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
06-18 23:11:04.476: E/AndroidRuntime(545): FATAL EXCEPTION: main
06-18 23:11:04.476: E/AndroidRuntime(545): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.celticwolf.alex/com.celticwolf.alex.Sendbrand}: java.lang.ClassNotFoundException: com.celticwolf.alex.Sendbrand
06-18 23:11:04.476: E/AndroidRuntime(545):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1879)
06-18 23:11:04.476: E/AndroidRuntime(545):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
06-18 23:11:04.476: E/AndroidRuntime(545):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
06-18 23:11:04.476: E/AndroidRuntime(545):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
06-18 23:11:04.476: E/AndroidRuntime(545):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-18 23:11:04.476: E/AndroidRuntime(545):  at android.os.Looper.loop(Looper.java:137)
06-18 23:11:04.476: E/AndroidRuntime(545):  at android.app.ActivityThread.main(ActivityThread.java:4340)
06-18 23:11:04.476: E/AndroidRuntime(545):  at java.lang.reflect.Method.invokeNative(Native Method)
06-18 23:11:04.476: E/AndroidRuntime(545):  at java.lang.reflect.Method.invoke(Method.java:511)
06-18 23:11:04.476: E/AndroidRuntime(545):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-18 23:11:04.476: E/AndroidRuntime(545):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-18 23:11:04.476: E/AndroidRuntime(545):  at dalvik.system.NativeStart.main(Native Method)
06-18 23:11:04.476: E/AndroidRuntime(545): Caused by: java.lang.ClassNotFoundException: com.celticwolf.alex.Sendbrand
06-18 23:11:04.476: E/AndroidRuntime(545):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-18 23:11:04.476: E/AndroidRuntime(545):  at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-18 23:11:04.476: E/AndroidRuntime(545):  at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-18 23:11:04.476: E/AndroidRuntime(545):  at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
06-18 23:11:04.476: E/AndroidRuntime(545):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870)
06-18 23:11:04.476: E/AndroidRuntime(545):  ... 11 more

按下右上角的onScreen Back按钮后,这是日志:

06-19 13:51:43.743: D/ActionBarSherlock(281): [callbackPrepareOptionsMenu] returning true
06-19 13:51:43.743: W/KeyCharacterMap(281): No keyboard for id -1
06-19 13:51:43.743: W/KeyCharacterMap(281): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
06-19 13:51:43.823: D/dalvikvm(281): GC_FOR_MALLOC freed 4847 objects / 237824 bytes in 58ms
06-19 13:51:43.833: E/Cursor(281): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.celticwolf.alex/databases/sqlbeerlist.sqlite, table = null, query = SELECT _id, fakebrand FROM nobeers
06-19 13:51:43.833: E/Cursor(281): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
06-19 13:51:43.833: E/Cursor(281):  at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:210)
06-19 13:51:43.833: E/Cursor(281):  at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
06-19 13:51:43.833: E/Cursor(281):  at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
06-19 13:51:43.833: E/Cursor(281):  at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1315)
06-19 13:51:43.833: E/Cursor(281):  at com.celticwolf.alex.DataBaseHelper.getnobeers(DataBaseHelper.java:264)
06-19 13:51:43.833: E/Cursor(281):  at com.celticwolf.alex.Game.getDatabase(Game.java:182)
06-19 13:51:43.833: E/Cursor(281):  at com.celticwolf.alex.Game.onCreate(Game.java:94)
06-19 13:51:43.833: E/Cursor(281):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-19 13:51:43.833: E/Cursor(281):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
06-19 13:51:43.833: E/Cursor(281):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-19 13:51:43.833: E/Cursor(281):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-19 13:51:43.833: E/Cursor(281):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-19 13:51:43.833: E/Cursor(281):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-19 13:51:43.833: E/Cursor(281):  at android.os.Looper.loop(Looper.java:123)
06-19 13:51:43.833: E/Cursor(281):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-19 13:51:43.833: E/Cursor(281):  at java.lang.reflect.Method.invokeNative(Native Method)
06-19 13:51:43.833: E/Cursor(281):  at java.lang.reflect.Method.invoke(Method.java:521)
06-19 13:51:43.833: E/Cursor(281):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-19 13:51:43.833: E/Cursor(281):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-19 13:51:43.833: E/Cursor(281):  at dalvik.system.NativeStart.main(Native Method)
06-19 13:51:43.833: I/dalvikvm(281): Could not find method com.actionbarsherlock.internal.view.menu.ActionMenuItemView.onHoverEvent, referenced from method com.actionbarsherlock.internal.view.menu.ActionMenuItemView.dispatchHoverEvent
06-19 13:51:43.833: W/dalvikvm(281): VFY: unable to resolve virtual method 6350: Lcom/actionbarsherlock/internal/view/menu/ActionMenuItemView;.onHoverEvent (Landroid/view/MotionEvent;)Z
06-19 13:51:43.833: D/dalvikvm(281): VFY: replacing opcode 0x6e at 0x0006
06-19 13:51:43.833: D/dalvikvm(281): VFY: dead code 0x0009-0009 in Lcom/actionbarsherlock/internal/view/menu/ActionMenuItemView;.dispatchHoverEvent (Landroid/view/MotionEvent;)Z
06-19 13:51:43.853: E/Cursor(281): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.celticwolf.alex/databases/sqlbeerlist.sqlite, table = null, query = SELECT _id, nobeercountry FROM nobeers
06-19 13:51:43.853: E/Cursor(281): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
06-19 13:51:43.853: E/Cursor(281):  at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:210)
06-19 13:51:43.853: E/Cursor(281):  at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
06-19 13:51:43.853: E/Cursor(281):  at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
06-19 13:51:43.853: E/Cursor(281):  at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1315)
06-19 13:51:43.853: E/Cursor(281):  at com.celticwolf.alex.DataBaseHelper.getnobeercountries(DataBaseHelper.java:284)
06-19 13:51:43.853: E/Cursor(281):  at com.celticwolf.alex.Game.getDatabase(Game.java:181)
06-19 13:51:43.853: E/Cursor(281):  at com.celticwolf.alex.Game.onCreate(Game.java:94)
06-19 13:51:43.853: E/Cursor(281):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-19 13:51:43.853: E/Cursor(281):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
06-19 13:51:43.853: E/Cursor(281):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-19 13:51:43.853: E/Cursor(281):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-19 13:51:43.853: E/Cursor(281):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-19 13:51:43.853: E/Cursor(281):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-19 13:51:43.853: E/Cursor(281):  at android.os.Looper.loop(Looper.java:123)
06-19 13:51:43.853: E/Cursor(281):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-19 13:51:43.853: E/Cursor(281):  at java.lang.reflect.Method.invokeNative(Native Method)
06-19 13:51:43.853: E/Cursor(281):  at java.lang.reflect.Method.invoke(Method.java:521)
06-19 13:51:43.853: E/Cursor(281):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-19 13:51:43.853: E/Cursor(281):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-19 13:51:43.853: E/Cursor(281):  at dalvik.system.NativeStart.main(Native Method)
06-19 13:51:43.853: I/dalvikvm(281): Could not find method android.widget.LinearLayout.onPopulateAccessibilityEvent, referenced from method com.actionbarsherlock.internal.view.menu.ActionMenuItemView.onPopulateAccessibilityEvent
06-19 13:51:43.853: W/dalvikvm(281): VFY: unable to resolve virtual method 4886: Landroid/widget/LinearLayout;.onPopulateAccessibilityEvent (Landroid/view/accessibility/AccessibilityEvent;)V
06-19 13:51:43.853: D/dalvikvm(281): VFY: replacing opcode 0x6f at 0x0006
06-19 13:51:43.873: E/Cursor(281): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.celticwolf.alex/databases/sqlbeerlist.sqlite, table = null, query = SELECT _id, country FROM beers
06-19 13:51:43.873: E/Cursor(281): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
06-19 13:51:43.873: E/Cursor(281):  at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:210)
06-19 13:51:43.873: E/Cursor(281):  at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
06-19 13:51:43.873: E/Cursor(281):  at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
06-19 13:51:43.873: E/Cursor(281):  at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1315)
06-19 13:51:43.873: E/Cursor(281):  at com.celticwolf.alex.DataBaseHelper.getcountries(DataBaseHelper.java:241)
06-19 13:51:43.873: E/Cursor(281):  at com.celticwolf.alex.Game.getDatabase(Game.java:180)
06-19 13:51:43.873: E/Cursor(281):  at com.celticwolf.alex.Game.onCreate(Game.java:94)
06-19 13:51:43.873: E/Cursor(281):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-19 13:51:43.873: E/Cursor(281):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
06-19 13:51:43.873: E/Cursor(281):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-19 13:51:43.873: E/Cursor(281):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-19 13:51:43.873: E/Cursor(281):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-19 13:51:43.873: E/Cursor(281):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-19 13:51:43.873: E/Cursor(281):  at android.os.Looper.loop(Looper.java:123)
06-19 13:51:43.873: E/Cursor(281):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-19 13:51:43.873: E/Cursor(281):  at java.lang.reflect.Method.invokeNative(Native Method)
06-19 13:51:43.873: E/Cursor(281):  at java.lang.reflect.Method.invoke(Method.java:521)
06-19 13:51:43.873: E/Cursor(281):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-19 13:51:43.873: E/Cursor(281):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-19 13:51:43.873: E/Cursor(281):  at dalvik.system.NativeStart.main(Native Method)
06-19 13:51:43.883: D/dalvikvm(281): DexOpt: couldn't find static field
06-19 13:51:43.883: W/dalvikvm(281): VFY: unable to resolve static field 5640 (ROOT) in Ljava/util/Locale;
06-19 13:51:43.883: D/dalvikvm(281): VFY: replacing opcode 0x62 at 0x0012
06-19 13:51:43.883: D/dalvikvm(281): VFY: dead code 0x0014-001a in Lcom/actionbarsherlock/internal/widget/CapitalizingButton;.setTextCompat (Ljava/lang/CharSequence;)V
06-19 13:51:43.903: E/Cursor(281): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.celticwolf.alex/databases/sqlbeerlist.sqlite, table = null, query = SELECT _id, brand FROM beers
06-19 13:51:43.903: E/Cursor(281): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
06-19 13:51:43.903: E/Cursor(281):  at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:210)
06-19 13:51:43.903: E/Cursor(281):  at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
06-19 13:51:43.903: E/Cursor(281):  at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
06-19 13:51:43.903: E/Cursor(281):  at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1315)
06-19 13:51:43.903: E/Cursor(281):  at com.celticwolf.alex.DataBaseHelper.getbeers(DataBaseHelper.java:221)
06-19 13:51:43.903: E/Cursor(281):  at com.celticwolf.alex.Game.getDatabase(Game.java:179)
06-19 13:51:43.903: E/Cursor(281):  at com.celticwolf.alex.Game.onCreate(Game.java:94)
06-19 13:51:43.903: E/Cursor(281):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-19 13:51:43.903: E/Cursor(281):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
06-19 13:51:43.903: E/Cursor(281):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-19 13:51:43.903: E/Cursor(281):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-19 13:51:43.903: E/Cursor(281):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-19 13:51:43.903: E/Cursor(281):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-19 13:51:43.903: E/Cursor(281):  at android.os.Looper.loop(Looper.java:123)
06-19 13:51:43.903: E/Cursor(281):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-19 13:51:43.903: E/Cursor(281):  at java.lang.reflect.Method.invokeNative(Native Method)
06-19 13:51:43.903: E/Cursor(281):  at java.lang.reflect.Method.invoke(Method.java:521)
06-19 13:51:43.903: E/Cursor(281):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-19 13:51:43.903: E/Cursor(281):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-19 13:51:43.903: E/Cursor(281):  at dalvik.system.NativeStart.main(Native Method)
06-19 13:51:44.043: D/dalvikvm(281): GC_EXTERNAL_ALLOC freed 2324 objects / 192104 bytes in 61ms
06-19 13:51:45.233: D/ActionBarSherlock(281): [dispatchStop]
06-19 13:51:46.733: D/ActionBarSherlock(281): [callbackOptionsItemSelected] item: null
06-19 13:51:46.733: D/AndroidRuntime(281): Shutting down VM
06-19 13:51:46.733: W/dalvikvm(281): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
06-19 13:51:46.743: E/AndroidRuntime(281): FATAL EXCEPTION: main
06-19 13:51:46.743: E/AndroidRuntime(281): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.celticwolf.alex/com.actionbarsherlock.view.Menu}; have you declared this activity in your AndroidManifest.xml?
06-19 13:51:46.743: E/AndroidRuntime(281):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
06-19 13:51:46.743: E/AndroidRuntime(281):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
06-19 13:51:46.743: E/AndroidRuntime(281):  at android.app.Activity.startActivityForResult(Activity.java:2817)
06-19 13:51:46.743: E/AndroidRuntime(281):  at android.app.Activity.startActivity(Activity.java:2923)
06-19 13:51:46.743: E/AndroidRuntime(281):  at com.celticwolf.alex.Game.onOptionsItemSelected(Game.java:679)
06-19 13:51:46.743: E/AndroidRuntime(281):  at com.actionbarsherlock.app.SherlockActivity.onMenuItemSelected(SherlockActivity.java:208)
06-19 13:51:46.743: E/AndroidRuntime(281):  at com.actionbarsherlock.ActionBarSherlock.callbackOptionsItemSelected(ActionBarSherlock.java:603)
06-19 13:51:46.743: E/AndroidRuntime(281):  at com.actionbarsherlock.internal.ActionBarSherlockCompat.onMenuItemSelected(ActionBarSherlockCompat.java:600)
06-19 13:51:46.743: E/AndroidRuntime(281):  at com.actionbarsherlock.internal.widget.ActionBarView$3.onClick(ActionBarView.java:163)
06-19 13:51:46.743: E/AndroidRuntime(281):  at android.view.View.performClick(View.java:2408)
06-19 13:51:46.743: E/AndroidRuntime(281):  at android.view.View$PerformClick.run(View.java:8816)
06-19 13:51:46.743: E/AndroidRuntime(281):  at android.os.Handler.handleCallback(Handler.java:587)
06-19 13:51:46.743: E/AndroidRuntime(281):  at android.os.Handler.dispatchMessage(Handler.java:92)
06-19 13:51:46.743: E/AndroidRuntime(281):  at android.os.Looper.loop(Looper.java:123)
06-19 13:51:46.743: E/AndroidRuntime(281):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-19 13:51:46.743: E/AndroidRuntime(281):  at java.lang.reflect.Method.invokeNative(Native Method)
06-19 13:51:46.743: E/AndroidRuntime(281):  at java.lang.reflect.Method.invoke(Method.java:521)
06-19 13:51:46.743: E/AndroidRuntime(281):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-19 13:51:46.743: E/AndroidRuntime(281):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-19 13:51:46.743: E/AndroidRuntime(281):  at dalvik.system.NativeStart.main(Native Method)
06-19 13:51:49.624: I/Process(281): Sending signal. PID: 281 SIG: 9

编辑1: @CommonsWare,我已经调整了“订单和出口”部分。有几个问题......

编辑2: 我使用的是JDK版本1.7.0_09 Order & Export

2 个答案:

答案 0 :(得分:1)

你看到了区别吗?

 <activity
    android:name=".Sendbrand"

 <activity
    android:name=".SendBrand"

第二个当然是正确的。干杯!

答案 1 :(得分:0)

尝试更新工具/ sdk,删除bin文件夹,运行完整清理。还要确保构建最新的工具/ api。

同时尝试使用ant构建可能有助于识别错误。