【问题标题】:Error "application has stopped unexpectedly" from my Android app我的 Android 应用程序出现错误“应用程序已意外停止”
【发布时间】:2012-06-12 18:15:22
【问题描述】:

原木猫:

    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

【问题讨论】:

    标签: android android-emulator android-logcat


    【解决方案1】:

    您的 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 ...)
    

    【讨论】:

      【解决方案2】:

      问题来了:

      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);
      

      【讨论】:

        【解决方案3】:

        错误就在 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 &lt;tablename&gt; (....

        【讨论】:

          【解决方案4】:

          看到这一行

          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

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2013-06-14
            • 1970-01-01
            相关资源
            最近更新 更多