1. Taro L. Saito
  2. sqlite-jdbc
  3. Issues
Issue #159 new

javaFX Android port crashes and fails to detect OS, request ability to use 'pure java'

Anonymous created an issue

first i'd like to thank you for the great work you have done for the community.

i have a javaFX program wtih your SQLite lib, with ant i am able to build a single jar file with SQLite lib included with it, the javaFX program and SQLite lib works perfectly on any platform supporting java, however my case is kinda different, i port/convert/compile my single jar file into an .apk for android, with adb i can see the the program crashes upon trying to detect OS on the dalvikvm, i think this happens because another 'virtual machine' is made in android to run javaFX unfortunately this vm is not as complete as the ones we have on our pcs

program crashes on this line (while attempting to load driver), Class.forname("org.sqlite.JDBC"); adb logcat says a bunch of jdbc stuff with dalvikvm going wrong one particularly talking about detecting OS

to solve this my idea is allow dev to forcefully enable pure java mode and eliminate the need to detect OS, something like this org.sqlite.JDBC.setEnablePureJavaMode(true); Class.forname("org.sqlite.JDBC");

this way the SQLite would be usable on unofficial vms and allow bigger range of developpers, i think the same issue would occur on roboVM which is the IOS counterpart of the javaFX ports

Comments (2)

  1. jonathan serrano

    i have tried the System.setProperty("sqlite.purejava", "true"); Class.forName("org.sqlite.JDBC"); still no avail when converted to android apk, same error is shown on loc cat

    12-03 01:25:22.919: W/dalvikvm(31484): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/sqlite/core/NativeDB; 12-03 01:25:22.923: W/System.err(31484): java.lang.reflect.InvocationTargetException 12-03 01:25:22.923: W/System.err(31484): at java.lang.reflect.Method.invokeNative(Native Method) 12-03 01:25:22.923: W/System.err(31484): at java.lang.reflect.Method.invoke(Method.java:511) 12-03 01:25:22.923: W/System.err(31484): at javafxports.android.DalvikLauncher$1.run(DalvikLauncher.java:125) 12-03 01:25:22.923: W/System.err(31484): at java.lang.Thread.run(Thread.java:838) 12-03 01:25:22.923: W/System.err(31484): Caused by: java.lang.RuntimeException: Exception in Application start method 12-03 01:25:22.924: W/System.err(31484): at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:875) 12-03 01:25:22.924: W/System.err(31484): at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$129(LauncherImpl.java:157) 12-03 01:25:22.924: W/System.err(31484): at com.sun.javafx.application.LauncherImpl.access$lambda$0(LauncherImpl.java) 12-03 01:25:22.924: W/System.err(31484): at com.sun.javafx.application.LauncherImpl$$Lambda$1.run(Unknown Source) 12-03 01:25:22.924: W/System.err(31484): ... 1 more 12-03 01:25:22.924: W/System.err(31484): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load sqlitejdbc from loader dalvik.system.DexClassLoader[DexPathList[[dex file "dalvik.system.DexFile@4125cd08", dex file "dalvik.system.DexFile@4125d0e8", zip file "/data/data/com.helloworld/app_dex/Application_resources.jar"],nativeLibraryDirectories=[/data/app-lib/com.helloworld-1, /vendor/lib, /system/lib]]]: findLibrary returned null 12-03 01:25:22.925: D/dalvikvm(31484): threadid=14: bye! 12-03 01:25:22.928: W/System.err(31484): at java.lang.Runtime.loadLibrary(Runtime.java:359) 12-03 01:25:22.928: W/System.err(31484): at java.lang.System.loadLibrary(System.java:514) 12-03 01:25:22.928: W/System.err(31484): at org.sqlite.core.NativeDB.<clinit>(NativeDB.java:35) 12-03 01:25:22.928: W/System.err(31484): at org.sqlite.core.CoreConnection.open(CoreConnection.java:136) 12-03 01:25:22.928: W/System.err(31484): at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:66) 12-03 01:25:22.928: W/System.err(31484): at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:21) 12-03 01:25:22.928: W/System.err(31484): at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:23) 12-03 01:25:22.928: W/System.err(31484): at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:45) 12-03 01:25:22.928: W/System.err(31484): at org.sqlite.JDBC.createConnection(JDBC.java:114) 12-03 01:25:22.929: W/System.err(31484): at org.sqlite.JDBC.connect(JDBC.java:88) 12-03 01:25:22.929: W/System.err(31484): at java.sql.DriverManager.getConnection(DriverManager.java:175) 12-03 01:25:22.929: W/System.err(31484): at java.sql.DriverManager.getConnection(DriverManager.java:140) 12-03 01:25:22.929: W/System.err(31484): at backend.DatabaseAccessor_PCplatform.establishConnection(DatabaseAccessor_PCplatform.java:81) 12-03 01:25:22.929: W/System.err(31484): at backend.DatabaseAccessor_PCplatform.selectcmd_static(DatabaseAccessor_PCplatform.java:138) 12-03 01:25:22.929: W/System.err(31484): at backend.DatabaseAccessor_PCplatform.selectcmd(DatabaseAccessor_PCplatform.java:33) 12-03 01:25:22.929: W/System.err(31484): at backend.DatabaseManager.selectCmd(DatabaseManager.java:39) 12-03 01:25:22.929: W/System.err(31484): at util.DRYcode.loadLocalData(DRYcode.java:405) 12-03 01:25:22.930: W/System.err(31484): at backend.StaticDataContainer.loadData(StaticDataContainer.java:77) 12-03 01:25:22.930: W/System.err(31484): at mobileView.Main.start(Main.java:30) 12-03 01:25:22.930: W/System.err(31484): at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$135(LauncherImpl.java:821) 12-03 01:25:22.930: W/System.err(31484): at com.sun.javafx.application.LauncherImpl.access$lambda$6(LauncherImpl.java) 12-03 01:25:22.930: W/System.err(31484): at com.sun.javafx.application.LauncherImpl$$Lambda$7.run(Unknown Source) 12-03 01:25:22.930: W/System.err(31484): at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$148(PlatformImpl.java:323) 12-03 01:25:22.930: W/System.err(31484): at com.sun.javafx.application.PlatformImpl.access$lambda$6(PlatformImpl.java) 12-03 01:25:22.931: W/System.err(31484): at com.sun.javafx.application.PlatformImpl$$Lambda$7.run(Unknown Source) 12-03 01:25:22.931: W/System.err(31484): at com.sun.javafx.application.PlatformImpl.lambda$null$146(PlatformImpl.java:292) 12-03 01:25:22.931: W/System.err(31484): at com.sun.javafx.application.PlatformImpl.access$lambda$17(PlatformImpl.java) 12-03 01:25:22.932: W/System.err(31484): at com.sun.javafx.application.PlatformImpl$$Lambda$18.run(Unknown Source) 12-03 01:25:22.935: D/dalvikvm(31484): threadid=15: exiting 12-03 01:25:22.935: D/dalvikvm(31484): threadid=15: bye! 12-03 01:25:22.935: W/System.err(31484): at java.security.AccessController.doPrivileged(AccessController.java:52) 12-03 01:25:22.935: W/System.err(31484): at com.sun.javafx.application.PlatformImpl.lambda$runLater$147(PlatformImpl.java:291) 12-03 01:25:22.936: W/System.err(31484): at com.sun.javafx.application.PlatformImpl.access$lambda$5(PlatformImpl.java) 12-03 01:25:22.936: W/System.err(31484): at com.sun.javafx.application.PlatformImpl$$Lambda$6.run(Unknown Source) 12-03 01:25:22.936: W/System.err(31484): at com.sun.glass.ui.lens.LensApplication$RunnableEvent.dispatch(LensApplication.java:169) 12-03 01:25:22.936: W/System.err(31484): at com.sun.glass.ui.lens.LensApplication._runLoop(LensApplication.java:854) 12-03 01:25:22.936: W/System.err(31484): at com.sun.glass.ui.lens.LensApplication.lambda$runLoop$53(LensApplication.java:911) 12-03 01:25:22.936: W/System.err(31484): at com.sun.glass.ui.lens.LensApplication.access$lambda$4(LensApplication.java) 12-03 01:25:22.936: W/System.err(31484): at com.sun.glass.ui.lens.LensApplication$$Lambda$5.run(Unknown Source) 12-03 01:25:22.936: W/System.err(31484): ... 1 more 12-03 01:25:22.936: D/dalvikvm(31484): threadid=13: exiting 12-03 01:25:22.936: D/dalvikvm(31484): threadid=13: bye!

  2. jonathan serrano

    how do i resolve this issue? i initially posted as anonymous now i want to resolve this, problem apparently is within the dalvik vm (android javaFX's very own JVM), i switched to h2 database cause it supports embedded mode and purely written in java, i have also read that the pure java mode lacks the latest features on SQLite which unfortunately i am using in my project, thank you for for your efforts with the SQLite i really am grateful for the compilation of native libs in a single java wrapper

  3. Log in to comment