在sql语句中用 if not exists
void create_table(){ SQLiteDatabase dbWireter = dbhelper.getWritableDatabase(); String sql = String.format("CREATE TABLE if not exists %s(%s %s DEFAULT %s,%s %s DEFAULT %s)", DB_TABLE, DB_COLUMN_NAME,"TEXT","NONE", DB_COLUMN_GENDER,"TEXT","NONE"); dbWireter.execSQL(sql); dbWireter.close(); }