android.database.sqlite.SQLiteException:near";)&引用;:语法错误(代码1)

android.database.sqlite.SQLiteException:near";)&引用;:语法错误(代码1),android,sqlite,Android,Sqlite,每件事我都检查了很多次,但还是收到了这个信息 android.database.sqlite.SQLiteException: near ")": syntax error (code 1): , while compiling: CREATE TABLE location (_id INTEGER PRIMARY KEY AUTOINCREMENT, location_setting TEXT UNIQUE NOT NULL, city_name TEXT NOT NULL, coord_la

每件事我都检查了很多次,但还是收到了这个信息

android.database.sqlite.SQLiteException: near ")": syntax error (code 1): , while compiling: CREATE TABLE location (_id INTEGER PRIMARY KEY AUTOINCREMENT, location_setting TEXT UNIQUE NOT NULL, city_name TEXT NOT NULL, coord_lat REAL NOT NULL, coord_long REAL NOT NULL,  );


它的拼写错误,检查你的最后一行

WeatherContract.LocationEntry.COLUMN_COORD_LONG+ " REAL NOT NULL, "+" );";
从末尾删除,在
NOT NULL
之后

WeatherContract.LocationEntry.COLUMN_COORD_LONG+ " REAL NOT NULL "+" );";
它在创建表查询中显示syntext错误消息。因为您在表的最后一个字段中添加了额外的
,(coma)
。 因此,从
SQL\u CREATE\u LOCATION\u表中删除
,(coma)
,如下所示,然后重试


WeatherContract.LocationEntry.COLUMN_COORD_LONG+ " REAL NOT NULL "+" );";
final String SQL_CREATE_LOCATION_TABLE = "CREATE TABLE "+ WeatherContract.LocationEntry.TABLE_NAME +" (" +
            WeatherContract.LocationEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "+
            WeatherContract.LocationEntry.COLUMN_LOCATION_SETTING +" TEXT UNIQUE NOT NULL, "+
            WeatherContract.LocationEntry.COLUMN_CITY_NAME + " TEXT NOT NULL, "+
            WeatherContract.LocationEntry.COLUMN_COORD_LAT + " REAL NOT NULL, "+
            WeatherContract.LocationEntry.COLUMN_COORD_LONG+ " REAL NOT NULL "+" );";