我有這個logcat的錯誤,我需要在這個理解有點進一步logcat的機器人解釋
03-03 09:46:32.729: D/dalvikvm(333): GC_EXTERNAL_ALLOC freed 70K, 52% free 2630K/5379K, external 1625K/2137K, paused 86ms
03-03 09:47:22.309: D/dalvikvm(333): GC_EXTERNAL_ALLOC freed 13K, 51% free 2661K/5379K, external 8109K/8532K, paused 114ms
03-03 09:47:35.579: D/dalvikvm(333): GC_EXTERNAL_ALLOC freed 11K, 51% free 2689K/5379K, external 11777K/12032K, paused 144ms
03-03 09:47:36.409: D/dalvikvm(333): GC_EXTERNAL_ALLOC freed 2K, 50% free 2694K/5379K, external 15403K/15700K, paused 94ms
03-03 09:47:43.379: D/dalvikvm(333): GC_EXTERNAL_ALLOC freed 8K, 50% free 2714K/5379K, external 16570K/18035K, paused 133ms
03-03 09:47:44.499: I/Database(333): sqlite returned: error code = 1, msg = AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY
03-03 09:47:44.499: E/Database(333): Failure 1 (AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY) on 0x2e8610 when preparing 'create table BEEFTAPA (_idINTEGER PRIMARY KEY AUTOINCREMENT, Content text not null);'.
03-03 09:47:44.519: D/AndroidRuntime(333): Shutting down VM
03-03 09:47:44.519: W/dalvikvm(333): threadid=1: thread exiting with uncaught exception (group=0x40015560)
03-03 09:47:44.569: E/AndroidRuntime(333): FATAL EXCEPTION: main
03-03 09:47:44.569: E/AndroidRuntime(333): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.filipinocuisine/com.example.filipinocuisine.menucategory1a1}: android.database.sqlite.SQLiteException: AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY: create table BEEFTAPA (_idINTEGER PRIMARY KEY AUTOINCREMENT, Content text not null);
03-03 09:47:44.569: E/AndroidRuntime(333): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
03-03 09:47:44.569: E/AndroidRuntime(333): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-03 09:47:44.569: E/AndroidRuntime(333): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-03 09:47:44.569: E/AndroidRuntime(333): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-03 09:47:44.569: E/AndroidRuntime(333): at android.os.Handler.dispatchMessage(Handler.java:99)
03-03 09:47:44.569: E/AndroidRuntime(333): at android.os.Looper.loop(Looper.java:123)
03-03 09:47:44.569: E/AndroidRuntime(333): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-03 09:47:44.569: E/AndroidRuntime(333): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 09:47:44.569: E/AndroidRuntime(333): at java.lang.reflect.Method.invoke(Method.java:507)
03-03 09:47:44.569: E/AndroidRuntime(333): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-03 09:47:44.569: E/AndroidRuntime(333): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-03 09:47:44.569: E/AndroidRuntime(333): at dalvik.system.NativeStart.main(Native Method)
03-03 09:47:44.569: E/AndroidRuntime(333): Caused by: android.database.sqlite.SQLiteException: AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY: create table BEEFTAPA (_idINTEGER PRIMARY KEY AUTOINCREMENT, Content text not null);
03-03 09:47:44.569: E/AndroidRuntime(333): at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
03-03 09:47:44.569: E/AndroidRuntime(333): at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1763)
03-03 09:47:44.569: E/AndroidRuntime(333): at com.example.filipinocuisine.SQLiteAdapter$SQLiteHelper.onCreate(SQLiteAdapter.java:83)
03-03 09:47:44.569: E/AndroidRuntime(333): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:126)
03-03 09:47:44.569: E/AndroidRuntime(333): at com.example.filipinocuisine.SQLiteAdapter.openToWrite(SQLiteAdapter.java:40)
03-03 09:47:44.569: E/AndroidRuntime(333): at com.example.filipinocuisine.menucategory1a1.onCreate(menucategory1a1.java:22)
03-03 09:47:44.569: E/AndroidRuntime(333): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-03 09:47:44.569: E/AndroidRuntime(333): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-03 09:47:44.569: E/AndroidRuntime(333): ... 11 more
03-03 09:47:47.229: I/Process(333): Sending signal. PID: 333 SIG: 9
03-03 09:47:48.939: D/dalvikvm(356): GC_EXTERNAL_ALLOC freed 71K, 52% free 2630K/5379K, external 1625K/2137K, paused 105ms
03-03 09:51:01.088: D/dalvikvm(356): GC_EXTERNAL_ALLOC freed 20K, 51% free 2662K/5379K, external 8109K/8532K, paused 108ms
03-03 09:51:04.738: D/dalvikvm(356): GC_EXTERNAL_ALLOC freed 11K, 50% free 2690K/5379K, external 11777K/12032K, paused 149ms
03-03 09:51:05.548: D/dalvikvm(356): GC_EXTERNAL_ALLOC freed 2K, 50% free 2694K/5379K, external 15403K/15700K, paused 89ms
03-03 09:58:54.388: D/dalvikvm(356): GC_EXPLICIT freed 6K, 50% free 2702K/5379K, external 16570K/18035K, paused 259ms
一些幫助從這些錯誤,我只能聽懂FF:
03-03 09:47:44.569: E/AndroidRuntime(333): at com.example.filipinocuisine.SQLiteAdapter.openToWrite(SQLiteAdapter.java:40)
03-03 09:47:44.569: E/AndroidRuntime(333): at com.example.filipinocuisine.menucategory1a1.onCreate(menucategory1a1.java:22)
它包含此代碼:
我menucategory1a1它所包含的FF:
mySQLiteAdapter.openToWrite();
在我的適配器:
public SQLiteAdapter openToWrite() throws android.database.SQLException {
sqLiteHelper = new SQLiteHelper(context, MYDATABASE_NAME, null, MYDATABASE_VERSION);
sqLiteDatabase = sqLiteHelper.getWritableDatabase();
return this;
我可以t find what
錯在我的代碼,在此先感謝您的任何建議
爲什麼不閱讀漂亮的「引起」行:*引起:android.database.sqlite.SQLiteException:AUTOINCREMENT只允許在INTEGER PRIMARY KEY上:create table BEEFTAPA(_idINTEGER PRIMARY KEY AUTOINCREMENT,Content text not null );'*在那裏獲取更多信息。似乎你忘了一個空間。 – 2013-03-03 02:32:31
謝謝@ A - C我再次運行它 – NewbieontheSide 2013-03-03 02:56:15