x


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:

  1. Download sqlite from http://sqlite.org;
  2. Compile http://sqlite.so and copy it into Plugins/Android
  3. Wrap around http://sqlite.so with C#
  4. 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

more ▼

asked Jul 05 '11 at 06:22 PM

rambramdt gravatar image

rambramdt
1 11 12 13

All right. I found a http://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 http://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

Jul 10 '11 at 04:28 PM rambramdt

You could get the same result, just adding System.Data.dll and Mono.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.

Jul 19 '11 at 03:06 PM Rustam Ganeyev

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.

Aug 24 '11 at 06:06 PM HashbangGames

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 ? (reminder : Android natively supports Sqlite, so it should be a supported feature) Bug reported under case 417539)

Sep 05 '11 at 10:10 AM n0mad

Update:

This is a MonoDroid 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

Sep 09 '11 at 01:19 PM rambramdt
(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

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.

more ▼

answered Sep 10 '12 at 07:13 PM

Oksana Iashchuk gravatar image

Oksana Iashchuk
61 1

(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Sep 12 '11 at 11:47 AM

n0mad gravatar image

n0mad
104 4 5 10

(comments are locked)
10|3000 characters needed characters left

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:sqlite3open 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?

more ▼

answered Jul 15 '11 at 09:40 PM

rambramdt gravatar image

rambramdt
1 11 12 13

@rambramdt: No. Mono doesn't allow you to run native windows dll files on linux. However pure managed code libraries (also the extension .dll) will run with Mono on any supported platform.

The Mono.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

Mar 26 '12 at 12:00 PM Bunny83
Sep 11 '12 at 03:56 AM Oksana Iashchuk
(comments are locked)
10|3000 characters needed characters left

I wish to hell I could down vote this answer. definitely not helpful in the least.

more ▼

answered Apr 13 '12 at 02:31 AM

digitalroar gravatar image

digitalroar
-3 2 2 2

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2474
x394
x49

asked: Jul 05 '11 at 06:22 PM

Seen: 4267 times

Last Updated: Sep 11 '12 at 03:56 AM