Skip to content Skip to sidebar Skip to footer

Android Studio 3.0 Canary 1 : Sql Syntax Error

I have a problem after upgraded to Android Studio 3.0 canary 1 from Android Studio 2.3 db.execSQL('CREATE TABLE IF NOT EXISTS ' + Contract.COUNTRY_PATH + ' (' + Con

Solution 1:

Do not put any spaces in you column name.

I'm using Android Studio 3.0 beta7. Same problem still exists.

Solution 2:

The SQL syntax checker in Android Studio 3 is stricter than sqlite itself.

INTEGER AUTO INCREMENT in sqlite itself basically just results in a column with integer affinity. The mistyped AUTO INCREMENT is just noise. That's why it gets flagged in Studio but does not cause a syntax error in sqlite.

If you want an autoincrementing column, make it INTEGER PRIMARY KEY. If you really need the rowid reuse avoidance, then the column should be INTEGER PRIMARY KEY AUTOINCREMENT. Note that you can only have one primary key column in a table. See also: https://sqlite.org/autoinc.html

Solution 3:

CREATETABLE yourtablename (id INTEGERprimary key autoincrement NOTNULL, name TEXT, description TEXT, expValue INTEGER, category INTEGERNOTNULLREFERENCES categories (id), date TEXT)

Post a Comment for "Android Studio 3.0 Canary 1 : Sql Syntax Error"