import haxe.db.Sqlite;
import openfl.filesystem.File;
var path:String="data.db";
var dbPath:String=File.applicationStorageDirectory.nativePath+"/"+path;
Sqlite.open(dbPath);
My first guess would be that you’re using a file, which is available on windows but on android is bundled in the apk. Or that you try to write next to the executable, failing for the same reason.
Without Sqlite.open project compile and launch on android device. In windows Sqlite.open create file, mb on android i must create it before open?
Thanks
import haxe.db.Sqlite;
import openfl.filesystem.File;
var path:String="data.db";
var dbPath:String=File.applicationStorageDirectory.nativePath+"/"+path;
Sqlite.open(dbPath);
how this will work with sqlite? I always use Assets to music png atlas image ect… but sqlite? i need to write and read the sqlite… Assets dont have getSqlite… and getBytes? where im gonna to store that bytes to read and write… i think is more easy to find a way to read the correct path to android…
Asset has getText and getByte which can allow you to write its content in File.applicationStorageDirectory.nativePath+"/data.db" and then use that path to open the connection to the database.
if you create from cero your db; lime.system.System.applicationStorageDirectory works perfect for the job but if you want to find a ready populate db it wont work, because i dont know where to put this db in the first place Dx
No I’m telling you to copy your existing db from the assets to the applicationStorageDirectory.
Something like sys.io.File.putContents(Assets.getText("db.sqlite"), System.applicationStorageDirectory + "/db.sqlite");
Then you’ll be able to use it through Sqlite.open(System.applicationStorageDirectory + "/db.sqlite");
Sage advice:  “don’t build it … supply it.”  Provide an empty database as an asset.
In that database, be sure to include some table which contains a “version number.”
Also … get right now(!) into the habit of aggressively checking the outcome of any operation that you do, so that your app can respond graciously to whatever happens instead of “crashing” ignonimously.
I try that but dont work, but now I found the problem, dont know why the sqlite/1,9,0/ndll/Android/libsqlite3-7.so was the name of the .so file when i install the haxelib install sqlite, but it was searching for libsqlite3-v7-so, so if you install the haxelib install sqlite now you just have to change that name and all gonna work fine…
Thanks for all the help, hope this help another users too