i ran your sqldb code on mine. my app is crashing in emulator when run. plz help

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

i ran your sqldb code on mine. my app is crashing in emulator when run. plz help

Saurabh
10-12 20:07:35.273  11260-11260/? I/art﹕ Not late-enabling -Xcheck:jni (already on)
10-12 20:07:35.476  11260-11272/? I/art﹕ Background sticky concurrent mark sweep GC freed 1711(108KB) AllocSpace objects, 0(0B) LOS objects, 29% free, 428KB/605KB, paused 35.220ms total 77.010ms
10-12 20:07:35.808  11260-11260/com.example.saurabh.sqliteapplication E/SQLiteLog﹕ (1) near "tablestudent_table": syntax error
10-12 20:07:35.810  11260-11260/com.example.saurabh.sqliteapplication D/AndroidRuntime﹕ Shutting down VM
10-12 20:07:35.822  11260-11260/com.example.saurabh.sqliteapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.saurabh.sqliteapplication, PID: 11260
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.saurabh.sqliteapplication/com.example.saurabh.sqliteapplication.MainActivity}: android.database.sqlite.SQLiteException: near "tablestudent_table": syntax error (code 1): , while compiling: create tablestudent_table (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, SURNAME TEXT, MARKS INTEGER)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
            at android.app.ActivityThread.access$800(ActivityThread.java:151)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5257)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
     Caused by: android.database.sqlite.SQLiteException: near "tablestudent_table": syntax error (code 1): , while compiling: create tablestudent_table (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, SURNAME TEXT, MARKS INTEGER)
            at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
            at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
            at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
            at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
            at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
            at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
            at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1674)
            at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1605)
            at com.example.saurabh.sqliteapplication.DatabaseHelper.onCreate(DatabaseHelper.java:28)
            at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:251)
            at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
            at com.example.saurabh.sqliteapplication.DatabaseHelper.<init>(DatabaseHelper.java:22)
            at com.example.saurabh.sqliteapplication.MainActivity.onCreate(MainActivity.java:17)
            at android.app.Activity.performCreate(Activity.java:5990)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
            at android.app.ActivityThread.access$800(ActivityThread.java:151)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5257)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
10-12 20:07:35.962  11260-11272/com.example.saurabh.sqliteapplication I/art﹕ Background sticky concurrent mark sweep GC freed 1345(183KB) AllocSpace objects, 0(0B) LOS objects, 24% free, 718KB/954KB, paused 3.862ms total 123.694ms
10-12 20:07:35.970  11260-11272/com.example.saurabh.sqliteapplication W/art﹕ Suspending all threads took: 7.762ms
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: i ran your sqldb code on mine. my app is crashing in emulator when run. plz help

sarfaraz
i am also having the same proble plzz guid me if u got solution
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: i ran your sqldb code on mine. my app is crashing in emulator when run. plz help

sarfaraz
In reply to this post by Saurabh
Hi all,
I code same video but cant create database
but now, i created
U can repair in public void onCreate(SQLiteDatabase db)
there is code:

public void onCreate(SQLiteDatabase db) {
        String SQL_String = "CREATE TABLE " + TABLE_NAME + "(" + COL_1 + " INTEGER PRIMARY KEY AUTOINCREMENT," + COL_2 + " TEXT," + COL_3 + " TEXT," + CoL_4 +"INTEGER"+ ")";
        db.execSQL(SQL_String);
    }
Loading...