I was able to recreate the problem on another machine, when creating a brand new Ionic project, my steps are as follows,
ionic start testApp tabs
cd testApp
ionic platform add android
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
I then altered the www/js/app.js
file, and added,
$ionicPlatform.ready(function() {
var db = window.sqlitePlugin.openDatabase({name: "my.db"});
});
and ran ionic run android --device
, at this point it works, and I am able to open the DB without any issues, but as soon as I add crosswalk, something goes awry,
ionic browser add crosswalk
ionic run android --device
which produces the before mentioned error, and the below output from adb logcat
,
D/AndroidChromeClient(18693): file:///android_asset/www/plugins/com.brodysoft.sqlitePlugin/www/SQLitePlugin.js: Line 171 : OPEN database: my.db
I/chromium(18693): [INFO:CONSOLE(171)] "OPEN database: my.db", source: file:///android_asset/www/plugins/com.brodysoft.sqlitePlugin/www/SQLitePlugin.js (171)
E/SQLitePlugin(18693): unexpected error, stopping db thread
E/SQLitePlugin(18693): com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: Couldn't load sqlite4java-android-armv7l from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.ionicframework.awsmapp346623-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.ionicframework.awsmapp346623-2, /vendor/lib, /system/lib]]]: findLibrary returned null
E/SQLitePlugin(18693): at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:97)
E/SQLitePlugin(18693): at com.almworks.sqlite4java.SQLiteConnection.open0(SQLiteConnection.java:1441)
E/SQLitePlugin(18693): at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:282)
E/SQLitePlugin(18693): at org.pgsqlite.SQLitePlugin.openDatabase(SQLitePlugin.java:235)
E/SQLitePlugin(18693): at org.pgsqlite.SQLitePlugin.access$000(SQLitePlugin.java:37)
E/SQLitePlugin(18693): at org.pgsqlite.SQLitePlugin$DBRunner.run(SQLitePlugin.java:652)
E/SQLitePlugin(18693): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/SQLitePlugin(18693): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/SQLitePlugin(18693): at java.lang.Thread.run(Thread.java:841)
E/SQLitePlugin(18693): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load sqlite4java-android-armv7l from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.ionicframework.awsmapp346623-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.ionicframework.awsmapp346623-2, /vendor/lib, /system/lib]]]: findLibrary returned null
E/SQLitePlugin(18693): at java.lang.Runtime.loadLibrary(Runtime.java:358)
E/SQLitePlugin(18693): at java.lang.System.loadLibrary(System.java:526)
E/SQLitePlugin(18693): at com.almworks.sqlite4java.Internal.tryLoadFromSystemPath(Internal.java:352)
E/SQLitePlugin(18693): at com.almworks.sqlite4java.Internal.loadLibraryX(Internal.java:124)
E/SQLitePlugin(18693): at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:95)
E/SQLitePlugin(18693): ... 8 more
D/AndroidChromeClient(18693): file:///android_asset/www/plugins/com.brodysoft.sqlitePlugin/www/SQLitePlugin.js: Line 192 : OPEN database: my.db failed, aborting any pending transactions
I/chromium(18693): [INFO:CONSOLE(192)] "OPEN database: my.db failed, aborting any pending transactions", source: file:///android_asset/www/plugins/com.brodysoft.sqlitePlugin/www/SQLitePlugin.js (192)
D/AndroidChromeClient(18693): file:///android_asset/www/plugins/com.brodysoft.sqlitePlugin/www/SQLitePlugin.js: Line 79 : Could not open database
I/chromium(18693): [INFO:CONSOLE(79)] "Could not open database", source: file:///android_asset/www/plugins/com.brodysoft.sqlitePlugin/www/SQLitePlugin.js (79)
Has anyone else run into this issue? Could someone please shed some light on this?
Thanks!