So my app is working fine with ionic serve
, but on a real Android 7.1.1 device Ionic Storage isn’t working.
In logcat I found (see first and last line, stacktrace in between).
05-13 17:27:50.191 I/chromium(18272): [INFO:CONSOLE(175)] "OPEN database: _ionicstorage", source: file:///android_asset/www/plugins/cordova-sqlite-storage/www/SQLitePlugin.js (175) 05-13 17:27:50.200 W/System.err(18272): org.json.JSONException: Index 1 out of range [0..1) 05-13 17:27:50.200 W/System.err(18272): at org.json.JSONArray.get(JSONArray.java:293) 05-13 17:27:50.200 W/System.err(18272): at org.json.JSONArray.getJSONArray(JSONArray.java:496) 05-13 17:27:50.200 W/System.err(18272): at com.nolanlawson.cordova.sqlite.SQLitePlugin.execInBackgroundAndReturnResults(SQLitePlugin.java:73) 05-13 17:27:50.200 W/System.err(18272): at com.nolanlawson.cordova.sqlite.SQLitePlugin.runInBackground(SQLitePlugin.java:66) 05-13 17:27:50.200 W/System.err(18272): at com.nolanlawson.cordova.sqlite.SQLitePlugin.access$000(SQLitePlugin.java:24) 05-13 17:27:50.200 W/System.err(18272): at com.nolanlawson.cordova.sqlite.SQLitePlugin$1.run(SQLitePlugin.java:56) 05-13 17:27:50.200 W/System.err(18272): at android.os.Handler.handleCallback(Handler.java:751) 05-13 17:27:50.200 W/System.err(18272): at android.os.Handler.dispatchMessage(Handler.java:95) 05-13 17:27:50.200 W/System.err(18272): at android.os.Looper.loop(Looper.java:154) 05-13 17:27:50.200 W/System.err(18272): at android.os.HandlerThread.run(HandlerThread.java:61) 05-13 17:27:50.219 I/chromium(18272): [INFO:CONSOLE(197)] "OPEN database: _ionicstorage FAILED, aborting any pending transactions", source: file:///android_asset/www/plugins/cordova-sqlite-storage/www/SQLitePlugin.js (197)
However, I have checked that cordova-plugin-sqlite-2
and cordova-sqlite-storage
are listed in both package.json
and config.xml
.
Any ideas?
Bonus fact, I don’t know if it might be related. It had been a long time since my app had been tested on this real device, so when I did ionic run android
I got an error.
Error: adb: Command failed with exit code 1 Error output: Failed to install /Users/sune/Code/gadabout/platforms/android/build/outputs/apk/android-debug.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
Since I have done ionic platform rm android && ionic platform add android
not long ago, I just tried uninstalled the app on the device, and then hit ionic run android
with success.
Could the old version of the app be hanging on to the database? Or unrelated?