Search code examples
androidsqliteactiveandroid

SQLite suddenly considers everything as not an error


It started on an Android phone, simple create statement in a file inside the assets/migrations folder (I use a 3rd party library called ActiveAndroid and for 2 years it worked okay - I did not changed anything about that):

CREATE TABLE IF NOT EXISTS Car (Brand TEXT);

I get this exception:

04-07 15:31:36.683  15738-15738/? E/SQLiteLog﹕ (21) API called with NULL prepared statement
04-07 15:31:36.683  15738-15738/? E/SQLiteLog﹕ (21) misuse at line 63243 of [00bb9c9ce4]
java.lang.RuntimeException: Unable to create application com.activeandroid.app.Application: android.database.sqlite.SQLiteException: not an error (code 0)


at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4394)
            at android.app.ActivityThread.access$1300(ActivityThread.java:141)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5041)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.database.sqlite.SQLiteException: not an error (code 0)
            at android.database.sqlite.SQLiteConnection.nativeExecuteForChangedRowCount(Native Method)
            at android.database.sqlite.SQLiteConnection.executeForChangedRowCount(SQLiteConnection.java:727)
            at android.database.sqlite.SQLiteSession.executeForChangedRowCount(SQLiteSession.java:754)
            at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:64)
            at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1665)
            at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1594)
            at com.activeandroid.DatabaseHelper.executeSqlScript(DatabaseHelper.java:185)
            at com.activeandroid.DatabaseHelper.executeMigrations(DatabaseHelper.java:155)
            at com.activeandroid.DatabaseHelper.onUpgrade(DatabaseHelper.java:78)
            at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:257)
            at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
            at com.activeandroid.Cache.openDatabase(Cache.java:104)
            at com.activeandroid.Cache.initialize(Cache.java:77)
            at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:43)
            at com.activeandroid.ActiveAndroid.initialize(ActiveAndroid.java:30)
            at com.activeandroid.app.Application.onCreate(Application.java:25)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1000)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4391)
            at android.app.ActivityThread.access$1300(ActivityThread.java:141)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5041)
            at java.lang.reflect.Method.invokeNative(Native Method)

So I checked it on my computer with a Firefox addon called SQLite Manager and created a brand new file (the file is totally unrelated to the Android database). I used this select and on the last error I get this:

enter image description here

It seems that every SQLite statement is a not an error statement.

Unfortunately, Android can't handle that.

What should I do?


Solution

  • It seems that the upgrade script in the assets\migration folder had some empty lines and that caused the not an error.