- Home /
Sqlite plugin for Android
Hello,
I am trying to get sqlite working on Android. I have a Mobile license for Android and I am developing on a Macbook Pro. Here is my plan of attack:
Download sqlite from sqlite.org;
Compile sqlite.so and copy it into Plugins/Android
Wrap around sqlite.so with C#
Use it in Javascript or C# elsewhere in my application
The only problem is I am self trained in computer and compiling is not exactly my strong point. I once compiled a shared library using Android NDK and thought this would be similar. Not at all. And the plugin example from Unity site (the one with the texture) came with the DLL already made so it doesn't help.
Could someone post a detailed direction on how to accomplish this. Or, if you have a better solution, please do share.
Jason
All right. I found a libsqlite.so and extracted it from my Droid phone using ADB. So, now I do not have to cross compile, thank God!
However, if there is already a libsqlite.so in the phone, why doesn't SQLite work? I tried to adjust the Android API level and the .NET compatibility in the player settings. Didn't help.
I know I am getting closer, but if somebody could help, I'll appreciate it deeply.
Jason
You could get the same result, just adding System.Data.dll and $$anonymous$$ono.Data.Sqlite.dll to Assets/Plugins folder. The problem you have is your droid didn't find sqlite3.dll. I have the same problem and I don't know how to deal with it.
bump
I have the exact same issue, and I have been unable to get around it. Please someone help us! it cannot be this hard to implement a sqlite database, Also, how will this effect us if we are developing for android & IOS?
please someone help.
Bump, same problem here ... sqlite3.dll won't be integrated into the Android build, for whatever reason. So how are we supposed to use Sqlite for Android ? (re$$anonymous$$der : Android natively supports Sqlite, so it should be a supported feature) Bug reported under case 417539)
Update:
This is a $$anonymous$$onoDroid issue. Contact them to get it fixed. In the mean time, consider Siaqodb. It is an object database with Unity support, reasonably priced. Their technical support has been highly responsive and helpful.
Jason
Answer by digitalroar · Apr 13, 2012 at 02:31 AM
I wish to hell I could down vote this answer. definitely not helpful in the least.
Answer by rambramdt · Jul 15, 2011 at 09:40 PM
OK, correct me if I am wrong. Mono allows linux-based systems to run dll files?
I am following the example from http://www.unifycommunity.com/wiki/index.php?title=SQLite It works in the editor and on Mac standalone, but it does not work for Android.
After unzipping the apk file, I see a Mono.Data.Sqlite.dll file under the Managed/ folder. When I tried to create a database through my app on a Droid, I got the following error from ddms:
07-15 13:27:33.550: INFO/Unity(31157): DllNotFoundException: sqlite3 07-15 13:27:33.550: INFO/Unity(31157): at (wrapper managed-to-native) Mono.Data.Sqlite.UnsafeNativeMethods:sqlite3_open_ v2 (byte[],intptr&,int,intptr) 07-15 13:27:33.550: INFO/Unity(31157): at Mono.Data.Sqlite.SQLite3.Open (System.String strFilename, SQLiteOpenFlagsEnum flags, Int32 maxPoolSize, Boolean usePool) [0x00000] in :0 07-15 13:27:33.550: INFO/Unity(31157): at Mono.Data.Sqlite.SqliteConnection.Open () [0x00000] in :0
Could anyone tell me what is going on?
@rambramdt: No. $$anonymous$$ono doesn't allow you to run native windows dll files on linux. However pure managed code libraries (also the extension .dll) will run with $$anonymous$$ono on any supported platform.
The $$anonymous$$ono.Data.Sqlite.dll is a mixedmode .NET assembly. While it is a managed code library it's just a wrapper to the native code dll SQLite3.dll
You might want to try this 100% managed code port of sqlite
I think you have to look at http://u3d.as/content/orange-tree/sqlite-kit/3ka
Answer by n0mad · Sep 12, 2011 at 11:47 AM
Some forum user kindly posted a Shared Object Library version of the sqlite3.dll, so it can work on Android. Here : http://forum.unity3d.com/threads/97043-Sqlite-for-Android-help-please?p=686204#13
Solved everything for me.
Answer by Oksana Iashchuk · Sep 10, 2012 at 07:13 PM
Please, check this -> http://u3d.as/content/orange-tree/sqlite-kit/3ka That is 100% managed code, full SQLite3 support, all platforms. No native dependencies.
Your answer
Follow this Question
Related Questions
SqlLite , android and unity 1 Answer
Sqlite4Unity3d difficulties 1 Answer
Launch of external activity from a unity freezes 0 Answers
Android Unity Plugin problem 0 Answers
Turn your Android device webcam (Camera) , flash light 3 Answers