从我的Android应用程序错误“应用程序已意外停止”

时间:2012-06-08 17:00:10

标签: android android-emulator android-logcat

Log cat:

    06-08 22:10:24.930: E/Zygote(32): setreuid() failed. errno: 2
    06-08 22:10:39.451: E/Zygote(32): setreuid() failed. errno: 17
    06-08 22:10:41.590: E/BatteryService(61): usbOnlinePath not found
    06-08 22:10:41.600: E/BatteryService(61): batteryVoltagePath not found
    06-08 22:10:41.600: E/BatteryService(61): batteryTemperaturePath not found
    06-08 22:10:41.610: E/SurfaceFlinger(61): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
    06-08 22:10:41.860: E/SensorService(61): couldn't open device for module sensors (Invalid argument)
    06-08 22:10:50.050: E/System(61): Failure starting core service
    06-08 22:10:50.050: E/System(61): java.lang.SecurityException
    06-08 22:10:50.050: E/System(61):   at android.os.BinderProxy.transact(Native Method)
    06-08 22:10:50.050: E/System(61):   at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
    06-08 22:10:50.050: E/System(61):   at android.os.ServiceManager.addService(ServiceManager.java:72)
    06-08 22:10:50.050: E/System(61):   at com.android.server.ServerThread.run(SystemServer.java:206)
    06-08 22:10:50.090: E/EventHub(61): could not get driver version for /dev/input/mouse0, Not a typewriter
    06-08 22:10:50.090: E/EventHub(61): could not get driver version for /dev/input/mice, Not a typewriter
    06-08 22:10:50.700: E/SoundPool(61): error loading /system/media/audio/ui/Effect_Tick.ogg
    06-08 22:10:50.710: E/SoundPool(61): error loading /system/media/audio/ui/KeypressStandard.ogg
    06-08 22:10:50.720: E/SoundPool(61): error loading /system/media/audio/ui/KeypressSpacebar.ogg
    06-08 22:10:50.730: E/SoundPool(61): error loading /system/media/audio/ui/KeypressDelete.ogg
    06-08 22:10:50.740: E/SoundPool(61): error loading /system/media/audio/ui/KeypressReturn.ogg
    06-08 22:10:50.790: E/UsbObserver(61): java.lang.NullPointerException
    06-08 22:10:50.790: E/UsbObserver(61):  at com.android.server.UsbObserver.init(UsbObserver.java:131)
    06-08 22:10:50.790: E/UsbObserver(61):  at com.android.server.UsbObserver.<init>(UsbObserver.java:65)
    06-08 22:10:50.790: E/UsbObserver(61):  at com.android.server.ServerThread.run(SystemServer.java:402)
    06-08 22:10:52.010: E/ThrottleService(61): Could not open GPS configuration file /etc/gps.conf
    06-08 22:10:53.540: E/logwrapper(154): executing /system/bin/tc failed: No such file or directory
    06-08 22:10:53.660: E/logwrapper(155): executing /system/bin/tc failed: No such file or directory
    06-08 22:10:53.740: E/logwrapper(158): executing /system/bin/tc failed: No such file or directory
    06-08 22:11:30.560: E/Database(320): Failure 1 (near "(": syntax error) on 0x29bd78 when preparing 'create table  (_id integer primary key autoincrement, question text not null, a text not null, b text not null, c text not null, d text not null, answer text not null, subject text not null);'.
    06-08 22:11:30.610: E/AndroidRuntime(320): FATAL EXCEPTION: main
    06-08 22:11:30.610: E/AndroidRuntime(320): java.lang.RuntimeException: Unable to start activity ComponentInfo{poo.sushie.ourproject/poo.sushie.ourproject.MyprojectActivity}: android.database.sqlite.SQLiteException: near "(": syntax error: create table  (_id integer primary key autoincrement, question text not null, a text not null, b text not null, c text not null, d text not null, answer text not null, subject text not null);
    06-08 22:11:30.610: E/AndroidRuntime(320):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at android.os.Handler.dispatchMessage(Handler.java:99)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at android.os.Looper.loop(Looper.java:123)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at android.app.ActivityThread.main(ActivityThread.java:3683)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at java.lang.reflect.Method.invokeNative(Native Method)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at java.lang.reflect.Method.invoke(Method.java:507)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at dalvik.system.NativeStart.main(Native Method)
    06-08 22:11:30.610: E/AndroidRuntime(320): Caused by: android.database.sqlite.SQLiteException: near "(": syntax error: create table  (_id integer primary key autoincrement, question text not null, a text not null, b text not null, c text not null, d text not null, answer text not null, subject text not null);
    06-08 22:11:30.610: E/AndroidRuntime(320):  at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1763)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at poo.sushie.ourproject.MyDBAdaptera$DatabaseHelper.onCreate(MyDBAdaptera.java:88)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:126)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at poo.sushie.ourproject.MyDBAdaptera.open(MyDBAdaptera.java:41)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at poo.sushie.ourproject.MyprojectActivity.onCreate(MyprojectActivity.java:24)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    06-08 22:11:30.610: E/AndroidRuntime(320):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
    06-08 22:11:30.610: E/AndroidRuntime(320):  ... 11 more

4 个答案:

答案 0 :(得分:0)

SQL 查询语法中存在错误:

create table  (_id integer primary key autoincrement, question text not null, a text not null, b text not null, c text not null, d text not null, answer text not null, subject text not null);

它说创建表,但它永远不会命名它。它应该是:

CREATE TABLE MyTableName (_id int ...)

答案 1 :(得分:0)

看到这一行

06-08 22:11:30.610: E/AndroidRuntime(320): Caused by: android.database.sqlite.SQLiteException: near "(": syntax error: create table  (_id integer primary key autoincrement, question text not null, a text not null, b text not null, c text not null, d text not null, answer text not null, subject text not null);

它说你的SQLite查询请检查语法。我想你还没有给出表名。

create table tablename

答案 2 :(得分:0)

错误就在logcat输出中:

06-08 22:11:30.610: E/AndroidRuntime(320): java.lang.RuntimeException: Unable to start activity ComponentInfo{poo.sushie.ourproject/poo.sushie.ourproject.MyprojectActivity}: android.database.sqlite.SQLiteException: near "(": syntax error: create table  (_id integer primary key autoincrement, question text not null, a text not null, b text not null, c text not null, d text not null, answer text not null, subject text not null);

它抱怨SQL中存在语法错误:您正在尝试创建表,但是您没有为表命名。

语法如下:create table <tablename> (....

答案 3 :(得分:0)

问题在于:

Caused by: android.database.sqlite.SQLiteException: near "(": syntax error: create table  (_id integer primary key autoincrement, question text not null, a text not null, b text not null, c text not null, d text not null, answer text not null, subject text not null);