我收到此错误,第一次做任何建议,为什么会来,以及如何解决它。 从这个链接我没有得到任何帮助 android.database.sqlite.SQLiteException near DATABASE_TABLE_NAME syntax error(code:1) while compiling organizationSetup
数据库处理程序
public class DatabaseHandler extends SQLiteOpenHelper {
// All Static variables
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "android_api";
// Login table name
private static final String TABLE_LOGIN = "login";
private static final String TABLE_TRACK = "track";
// Login Table Columns names
private static final String KEY_ID = "id";
private static final String KEY_NAME = "name";
private static final String KEY_EMAIL = "email";
private static final String KEY_UID = "uid";
private static final String KEY_CREATED_AT = "created_at";
// Track Table Columns names
private static final String KEY_UIDTRACK = "idtrack";
private static final String KEY_DOCKETNO = "docketno";
private static final String KEY_DEALERNAME = "dealername";
private static final String KEY_CUSTOMERNAME = "customername";
private static final String KEY_PCS = "pcs";
private static final String KEY_DELIVERY_STATUS = "deliverstatus";
private static final String KEY_REMARKS = "remarks";
private static final String KEY_CREATED_AT_TRACK = "created_at_track";
public DatabaseHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Creating Tables
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_LOGIN_TABLE = "CREATE TABLE " + TABLE_LOGIN + "("
+ KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT,"
+ KEY_EMAIL + " TEXT UNIQUE," + KEY_UID + " TEXT,"
+ KEY_CREATED_AT + " TEXT" + ")";
String CREATE_TABLE_TRACK = "CREATE TABLE " + TABLE_TRACK + "("
+ KEY_UIDTRACK + " INTEGER PRIMARY KEY," + KEY_DOCKETNO
+ "INTEGER PRIMARY KEY," + KEY_DEALERNAME + " TEXT,"
+ KEY_CUSTOMERNAME + " TEXT ," + KEY_PCS
+ "INTEGER PRIMARY KEY," + KEY_DELIVERY_STATUS + " TEXT ,"
+ KEY_REMARKS + " TEXT ," + KEY_CREATED_AT_TRACK + " TEXT"
+ ")";
db.execSQL(CREATE_LOGIN_TABLE);
db.execSQL(CREATE_TABLE_TRACK);
}
// Upgrading database
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// Drop older table if existed
db.execSQL("DROP TABLE IF EXISTS " + TABLE_LOGIN);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_TRACK);
// Create tables again
onCreate(db);
}
/**
* Storing user details in database
* */
public void addUser(String name, String email, String uid, String created_at) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_NAME, name); // Name
values.put(KEY_EMAIL, email); // Email
values.put(KEY_UID, uid); // Email
// Inserting Row
db.insert(TABLE_LOGIN, null, values);
db.close(); // Closing database connection
}
/**
* Storing AeyeTrack details in database
* */
public void addAeyeTrack(Integer idtrack, Integer docketno,
String dealername, String customername, Integer pcs,
String deliverstatus, String remarks, String created_at_track) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_UIDTRACK, idtrack); // idtrack
values.put(KEY_DOCKETNO, docketno); // docketno
values.put(KEY_DEALERNAME, dealername); // dealername
values.put(KEY_CUSTOMERNAME, customername); // customername
values.put(KEY_PCS, pcs); // pcs
values.put(KEY_DELIVERY_STATUS, deliverstatus); // deliverstatus
values.put(KEY_REMARKS, remarks); // remarks
values.put(KEY_CREATED_AT_TRACK, created_at_track); // created_at_track
// Inserting Row
db.insert(TABLE_TRACK, null, values);
db.close(); // Closing database connection
}
/**
* Getting update AeyeTrack data from database
* */
public boolean updateAeyeTrack(Integer idtrack, Integer docketno,
String dealername, String customername, Integer pcs,
String deliverstatus, String remarks, String created_at_track) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(KEY_UIDTRACK, idtrack); // idtrack
contentValues.put(KEY_DOCKETNO, docketno); // docketno
contentValues.put(KEY_DEALERNAME, dealername); // dealername
contentValues.put(KEY_CUSTOMERNAME, customername); // customername
contentValues.put(KEY_PCS, pcs); // pcs
contentValues.put(KEY_DELIVERY_STATUS, deliverstatus); // deliverstatus
contentValues.put(KEY_REMARKS, remarks); // remarks
contentValues.put(KEY_CREATED_AT_TRACK, created_at_track); // created_at_track
db.update("track", contentValues, "idtrack = ? ",
new String[] { Integer.toString(idtrack) });
return true;
}
/**
* Getting AeyeTrack data from database
* */
public HashMap<String, String> getAeyeTrackDetails() {
HashMap<String, String> AeyeTrack = new HashMap<String, String>();
String selectQuery = "SELECT * FROM " + TABLE_TRACK;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// Move to first row
cursor.moveToFirst();
if (cursor.getCount() > 0) {
AeyeTrack.put("idtrack", cursor.getString(1));
AeyeTrack.put("docketno", cursor.getString(2));
AeyeTrack.put("uid", cursor.getString(3));
AeyeTrack.put("dealername", cursor.getString(4));
AeyeTrack.put("customername", cursor.getString(5));
AeyeTrack.put("pcs", cursor.getString(6));
AeyeTrack.put("deliverstatus", cursor.getString(7));
AeyeTrack.put("remarks", cursor.getString(8));
AeyeTrack.put("created_at_track", cursor.getString(9));
}
cursor.close();
db.close();
// return user
return AeyeTrack;
}
/**
* Getting user data from database
* */
public HashMap<String, String> getUserDetails() {
HashMap<String, String> user = new HashMap<String, String>();
String selectQuery = "SELECT * FROM " + TABLE_LOGIN;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// Move to first row
cursor.moveToFirst();
if (cursor.getCount() > 0) {
user.put("name", cursor.getString(1));
user.put("email", cursor.getString(2));
user.put("uid", cursor.getString(3));
user.put("created_at", cursor.getString(4));
}
cursor.close();
db.close();
// return user
return user;
}
/**
* Getting user login status return true if rows are there in table
* */
public int getRowCount() {
String countQuery = "SELECT * FROM " + TABLE_LOGIN;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(countQuery, null);
int rowCount = cursor.getCount();
db.close();
cursor.close();
// return row count
return rowCount;
}
/**
* Re create database Delete all tables and create them again
* */
public void resetTables() {
SQLiteDatabase db = this.getWritableDatabase();
// Delete All Rows
db.delete(TABLE_LOGIN, null, null);
db.delete(TABLE_TRACK, null, null);
db.close();
}
}
This is my filtered logcat for my app
01-10 11:54:03.150: I/PGA(2997): New SOCKET connection: m.awl.aeyetrack (pid 2997, tid 2997)
01-10 11:54:17.840: D/Button(2997): Login
01-10 11:54:17.840: I/System.out(2997): Email -- >pk@gmail.com
01-10 11:54:17.840: I/System.out(2997): Password-->123456
01-10 11:54:17.850: I/System.out(2997): password < === > 123456
01-10 11:54:17.850: I/System.out(2997): email < === > pk@gmail.com
01-10 11:54:17.850: I/System.out(2997): tag < === > login
01-10 11:54:23.560: I/System.out(2997): Response ---> {"tag":"login","success":1,"error":0,"uid":"110085","user":{"name":"poonam","email":"pk@gmail.com","created_at":"2015-01-03 12:42:27","updated_at":null}}
01-10 11:54:23.560: I/System.out(2997): Response from Web Service -- >{"tag":"login","success":1,"error":0,"uid":"110085","user":{"name":"poonam","email":"pk@gmail.com","created_at":"2015-01-03 12:42:27","updated_at":null}}
01-10 11:54:23.630: E/SQLiteDatabase(2997): Error inserting uid=110085 email=pk@gmail.com name=poonam
01-10 11:54:23.630: E/SQLiteDatabase(2997): android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
01-10 11:54:23.630: E/SQLiteDatabase(2997): at android.database.sqlite.SQLiteStatement.native_executeInsert(Native Method)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:113)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1718)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1591)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at com.awl.aeyetrack.utils.DatabaseHandler.addUser(DatabaseHandler.java:85)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at com.awl.aeyetrack.LoginActivity$1.onTaskCompleted(LoginActivity.java:156)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at com.awl.aeyetrack.utils.Controller$AsyncHttpRequest.onPostExecute(Controller.java:126)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at com.awl.aeyetrack.utils.Controller$AsyncHttpRequest.onPostExecute(Controller.java:1)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at android.os.AsyncTask.finish(AsyncTask.java:602)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at android.os.AsyncTask.access$600(AsyncTask.java:156)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at android.os.Handler.dispatchMessage(Handler.java:99)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at android.os.Looper.loop(Looper.java:137)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at java.lang.reflect.Method.invokeNative(Native Method)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at java.lang.reflect.Method.invoke(Method.java:511)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
01-10 11:54:23.630: E/SQLiteDatabase(2997): at dalvik.system.NativeStart.main(Native Method)
01-10 11:54:25.770: D/dalvikvm(2997): Trying to load lib /data/data/com.awl.aeyetrack/lib/libiconv.so 0xb30aa270
01-10 11:54:25.770: D/dalvikvm(2997): Added shared lib /data/data/com.awl.aeyetrack/lib/libiconv.so 0xb30aa270
01-10 11:54:25.770: D/dalvikvm(2997): No JNI_OnLoad found in /data/data/com.awl.aeyetrack/lib/libiconv.so 0xb30aa270, skipping init
01-10 11:54:25.770: D/dalvikvm(2997): Trying to load lib /data/data/com.awl.aeyetrack/lib/libzbarjni.so 0xb30aa270
01-10 11:54:25.770: D/dalvikvm(2997): Added shared lib /data/data/com.awl.aeyetrack/lib/libzbarjni.so 0xb30aa270
01-10 11:54:25.770: V/dalvikvm(2997): +++ not scanning '/system/lib/libwebcore.so' for 'init' (wrong CL)
01-10 11:54:25.770: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libiconv.so' for 'init'
01-10 11:54:25.770: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_ImageScanner_init)
01-10 11:54:25.770: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_ImageScanner_init__)
01-10 11:54:25.770: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libzbarjni.so' for 'init'
01-10 11:54:25.770: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_ImageScanner_init)
01-10 11:54:25.770: V/dalvikvm(2997): Found 'Java_net_sourceforge_zbar_ImageScanner_init' with dlsym - func=0xab81c600
01-10 11:54:25.770: V/dalvikvm(2997): +++ not scanning '/system/lib/libwebcore.so' for 'create' (wrong CL)
01-10 11:54:25.770: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libiconv.so' for 'create'
01-10 11:54:25.770: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_ImageScanner_create)
01-10 11:54:25.770: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_ImageScanner_create__)
01-10 11:54:25.770: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libzbarjni.so' for 'create'
01-10 11:54:25.770: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_ImageScanner_create)
01-10 11:54:25.770: V/dalvikvm(2997): Found 'Java_net_sourceforge_zbar_ImageScanner_create' with dlsym - func=0xab81c7d0
01-10 11:54:25.770: V/dalvikvm(2997): +++ not scanning '/system/lib/libwebcore.so' for 'setConfig' (wrong CL)
01-10 11:54:25.770: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libiconv.so' for 'setConfig'
01-10 11:54:25.770: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_ImageScanner_setConfig)
01-10 11:54:25.770: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_ImageScanner_setConfig__III)
01-10 11:54:25.770: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libzbarjni.so' for 'setConfig'
01-10 11:54:25.770: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_ImageScanner_setConfig)
01-10 11:54:25.770: V/dalvikvm(2997): Found 'Java_net_sourceforge_zbar_ImageScanner_setConfig' with dlsym - func=0xab81c740
01-10 11:54:25.940: D/dalvikvm(2997): GC_FOR_ALLOC freed 1334K, 35% free 6689K/10243K, paused 10ms
01-10 11:54:25.950: D/dalvikvm(2997): Trying to load lib /data/data/com.awl.aeyetrack/lib/libzbarjni.so 0xb30aa270
01-10 11:54:25.950: D/dalvikvm(2997): Shared lib '/data/data/com.awl.aeyetrack/lib/libzbarjni.so' already loaded in same CL 0xb30aa270
01-10 11:54:25.950: V/dalvikvm(2997): +++ not scanning '/system/lib/libwebcore.so' for 'setFormat' (wrong CL)
01-10 11:54:25.950: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libiconv.so' for 'setFormat'
01-10 11:54:25.950: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_Image_setFormat)
01-10 11:54:25.950: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_Image_setFormat__Ljava_lang_String_2)
01-10 11:54:25.950: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libzbarjni.so' for 'setFormat'
01-10 11:54:25.950: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_Image_setFormat)
dlsy
01-10 11:54:25.950: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_ImageScanner_scanImage)
01-10 11:54:25.950: V/dalvikvm(2997): Found 'Java_net_sourceforge_zbar_ImageScanner_scanImage' with dlsym - func=0xab81dce0
01-10 11:54:26.120: D/dalvikvm(2997): GC_FOR_ALLOC freed 95K, 27% free 7957K/10755K, paused 0ms
01-10 11:55:03.550: D/dalvikvm(2997): Trying to load lib /data/data/com.awl.aeyetrack/lib/libzbarjni.so 0xb30aa270
01-10 11:55:03.550: D/dalvikvm(2997): Shared lib '/data/data/com.awl.aeyetrack/lib/libzbarjni.so' already loaded in same CL 0xb30aa270
01-10 11:55:03.550: V/dalvikvm(2997): +++ retrieving /data/data/com.awl.aeyetrack/lib/libzbarjni.so OnLoad status
01-10 11:55:03.550: V/dalvikvm(2997): +++ earlier OnLoad(/data/data/com.awl.aeyetrack/lib/libzbarjni.so) okay
01-10 11:55:03.550: V/dalvikvm(2997): +++ not scanning '/system/lib/libwebcore.so' for 'init' (wrong CL)
dlsym(Java_net_sourceforge_zbar_Symbol_next)
01-10 11:55:03.550: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_Symbol_next__)
01-10 11:55:03.550: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libzbarjni.so' for 'next'
01-10 11:55:03.550: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_Symbol_next)
01-10 11:55:03.550: V/dalvikvm(2997): Found 'Java_net_sourceforge_zbar_Symbol_next' with dlsym - func=0xab81d100
01-10 11:55:03.550: V/dalvikvm(2997): +++ not scanning '/system/lib/libwebcore.so' for 'getData' (wrong CL)
01-10 11:55:03.550: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libiconv.so' for 'getData'
01-10 11:55:03.550: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_Symbol_getData)
01-10 11:55:03.550: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_Symbol_getData__)
01-10 11:55:03.550: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libzbarjni.so' for 'getData'
01-10 11:55:03.550: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_Symbol_getData)
01-10 11:55:03.550: V/dalvikvm(2997): Found 'Java_net_sourceforge_zbar_Symbol_getData' with dlsym - func=0xab81d340
01-10 11:55:03.550: V/dalvikvm(2997): +++ not scanning '/system/lib/libwebcore.so' for 'getType' (wrong CL)
01-10 11:55:03.550: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libiconv.so' for 'getType'
01-10 11:55:03.550: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_Symbol_getType)
01-10 11:55:03.550: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_Symbol_getType__J)
01-10 11:55:03.550: V/dalvikvm(2997): +++ scanning '/data/data/com.awl.aeyetrack/lib/libzbarjni.so' for 'getType'
01-10 11:55:03.550: V/dalvikvm(2997): +++ calling dlsym(Java_net_sourceforge_zbar_Symbol_getType)
01-10 11:55:03.550: V/dalvikvm(2997): Found 'Java_net_sourceforge_zbar_Symbol_getType' with dlsym - func=0xab81d4e0
01-10 11:55:03.630: I/System.out(2997): Scanned Result--->122100138237
01-10 11:55:03.690: I/dalvikvm(2997): Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
01-10 11:55:03.690: W/dalvikvm(2997): VFY: unable to resolve virtual method 11401: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
01-10 11:55:03.690: D/dalvikvm(2997): VFY: replacing opcode 0x6f at 0x0000
01-10 11:55:03.690: I/dalvikvm(2997): Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
01-10 11:55:03.690: W/dalvikvm(2997): VFY: unable to resolve virtual method 11407: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
01-10 11:55:03.690: D/dalvikvm(2997): VFY: replacing opcode 0x6f at 0x0000
01-10 11:55:03.690: I/dalvikvm(2997): Could not find method android.view.ViewGroup.onWindowSystemUiVisibilityChanged, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onWindowSystemUiVisibilityChanged
01-10 11:55:03.690: W/dalvikvm(2997): VFY: unable to resolve virtual method 11409: Landroid/view/ViewGroup;.onWindowSystemUiVisibilityChanged (I)V
01-10 11:55:03.690: D/dalvikvm(2997): VFY: replacing opcode 0x6f at 0x0008
01-10 11:55:03.690: I/dalvikvm(2997): Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
01-10 11:55:03.690: W/dalvikvm(2997): VFY: unable to resolve virtual method 9088: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
01-10 11:55:03.690: D/dalvikvm(2997): VFY: replacing opcode 0x6e at 0x000e
01-10 11:55:03.700: I/dalvikvm(2997): Could not find method android.view.ViewGroup.onRtlPropertiesChanged, referenced from method android.support.v7.widget.Toolbar.onRtlPropertiesChanged
01-10 11:55:03.700: W/dalvikvm(2997): VFY: unable to resolve virtual method 11404: La
01-10 11:55:03.740: I/System.out(2997): Got this Scanned Result From Intent-->122100138237
01-10 11:55:03.740: I/SqliteDatabaseCpp(2997): sqlite returned: error code = 1, msg = no such table: track, db=/data/data/com.awl.aeyetrack/databases/android_api
01-10 11:55:03.740: D/AndroidRuntime(2997): Shutting down VM
01-10 11:55:03.740: W/dalvikvm(2997): threadid=1: thread exiting with uncaught exception (group=0xb2c6b180)
01-10 11:55:03.740: D/AndroidRuntime(2997): procName from cmdline: com.awl.aeyetrack
01-10 11:55:03.740: E/AndroidRuntime(2997): in writeCrashedAppName, pkgName :com.awl.aeyetrack
01-10 11:55:03.740: D/AndroidRuntime(2997): file written successfully with content: com.awl.aeyetrack StringBuffer : ;com.awl.aeyetrack
01-10 11:55:03.750: I/Process(2997): Sending signal. PID: 2997 SIG: 9
01-10 11:55:03.750: E/AndroidRuntime(2997): FATAL EXCEPTION: main
01-10 11:55:03.750: E/AndroidRuntime(2997): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.awl.aeyetrack/com.awl.aeyetrack.DashboardActivity}: android.database.sqlite.SQLiteException: no such table: track: , while compiling: SELECT * FROM track
01-10 11:55:03.750: E/AndroidRuntime(2997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
01-10 11:55:03.750: E/AndroidRuntime(2997): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-10 11:55:03.750: E/AndroidRuntime(2997): at android.app.ActivityThread.access$600(ActivityThread.java:123)
01-10 11:55:03.750: E/AndroidRuntime(2997): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-10 11:55:03.750: E/AndroidRuntime(2997): at android.os.Handler.dispatchMessage(Handler.java:99)
01-10 11:55:03.750: E/AndroidRuntime(2997): at android.os.Looper.loop(Looper.java:137)
01-10 11:55:03.750: E/AndroidRuntime(2997): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-10 11:55:03.750: E/AndroidRuntime(2997): at java.lang.reflect.Method.invokeNative(Native Method)
01-10 11:55:03.750: E/AndroidRuntime(2997): at java.lang.reflect.Method.invoke(Method.java:511)
01-10 11:55:03.750: E/AndroidRuntime(2997): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
01-10 11:55:03.750: E/AndroidRuntime(2997): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:592)
01-10 11:55:03.750: E/AndroidRuntime(2997): at dalvik.system.NativeStart.main(Native Method)
01-10 11:55:03.750: E/AndroidRuntime(2997): Caused by: android.database.sqlite.SQLiteException: no such table: track: , while compiling: SELECT * FROM track
答案 0 :(得分:1)
我看到你的CREATE_TABLE_TRACK中有两个主键,所以只需删除其中一个来解决问题。像这样:
//just removed one of ypur primary keys
String CREATE_TABLE_TRACK = "CREATE TABLE " + TABLE_TRACK + "("
+ KEY_UIDTRACK + " INTEGER PRIMARY KEY," + KEY_DOCKETNO
+ " INTEGER ," + KEY_DEALERNAME + " TEXT,"
+ KEY_CUSTOMERNAME + " TEXT ," + KEY_PCS
+ " INTEGER ," + KEY_DELIVERY_STATUS + " TEXT ,"
+ KEY_REMARKS + " TEXT ," + KEY_CREATED_AT_TRACK + " TEXT"
+ ")";
正如@Mike M所说,你的代码中有一些语法错误。我也修好了它们。