cbl_collator.jar causing linkerror

36 views
Skip to first unread message

Michael Hines

unread,
May 27, 2014, 7:00:32 AM5/27/14
to mobile-c...@googlegroups.com
Hi,

I'm attempting to using couchbase in the Kivy framework (python). 

I've successfully created an APK and imported the pre-built jar files from couchbase-lite-0.0.0-389 from Jenkins.

Then, I included all the jar files into my APK using example code from the "LiteServ" github project.

When I push the APK to the device and try to start it, the app starts up fine (I can see a simple UI with a push button that I threw in there), 
but then I get this error:

E/AndroidRuntime( 2163): FATAL EXCEPTION: Thread-102920
E/AndroidRuntime( 2163): java.lang.UnsatisfiedLinkError: Couldn't load sdl from loader dalvik.system.PathClassLoader[dexPath=/data/app/org.test.myapp-1.apk,libraryPath=/data/app-lib/org.test.myapp-1]: findLibrary returned null
E/AndroidRuntime( 2163):        at java.lang.Runtime.loadLibrary(Runtime.java:365)
E/AndroidRuntime( 2163):        at java.lang.System.loadLibrary(System.java:535)
E/AndroidRuntime( 2163):        at org.renpy.android.PythonActivity.run(PythonActivity.java:250)
E/AndroidRuntime( 2163):        at java.lang.Thread.run(Thread.java:856)

This error goes away when I remove the "cbl_collator.jar" file from the APK (but of course, that prevents
the database creation Java code from succeeding because it needs the TDCollator class.)

So, what is it exactly that cbl_collator is trying to load, and why? Am I missing another jar? Some other library?

Thanks!

Traun Leyden

unread,
May 27, 2014, 11:13:08 AM5/27/14
to mobile-c...@googlegroups.com

The cbl_collator.jar contains a few native collators: native meaning that they are compiled as native .so shared library objects, and collators meaning they are related to how certain things in the database are compared for sort order purposes.  We had to write custom collators for sqlite, and they needed to be native objects because sqlite doesn't provide an easy way to do this in java.

They are a major pain in the ass to deal with .. especially when you leave the Android Studio / gradle / maven world.

For Eclipse, we give instructions on unzipping this jar and tweaking the directory structure.  See here.  I imagine you might want to do the same, or perhaps build an APK with Eclipse then study how it's packaged, and do the same on your side.

Btw please post the solution when you figure it out.




--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/eb6dae82-b8ce-42fd-bf7c-df7596003b58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Hines

unread,
May 28, 2014, 6:57:26 AM5/28/14
to mobile-c...@googlegroups.com
OK, great - I will give this a try and report back my results. Thanks for the response.

- Michael

Michael Hines

unread,
May 28, 2014, 8:30:26 AM5/28/14
to mobile-c...@googlegroups.com
Alright, so I extracted cbl_collator.jar into its constituent .so parts and included all of them in the APK manually, but I'm still getting the same error.(java.lang.UnsatisfiedLinkError: Couldn't load sdl from loader dalvik.system.PathClassLoader)

,,,,Same as before - if I omit the .so libraries from the API, the link error goes away, but the app dies trying to reference find the TDCollator classes which come from those libraries.

What can I do next? What is it about these libraries that's trying to pull in "sdl" (whatever that is).

- Michael

On Tuesday, May 27, 2014 3:13:08 PM UTC, Traun Leyden wrote:

Traun Leyden

unread,
May 28, 2014, 11:15:28 AM5/28/14
to mobile-c...@googlegroups.com
I think you should try manually excluding the x86 directory.

When I googled for that error, this came up:





Michael Hines

unread,
May 28, 2014, 1:41:57 PM5/28/14
to mobile-c...@googlegroups.com
You were right! (Almost) Not only did I need to remove the x86 directory,
but I also needed to remove the armebiv7 directory.

Actually my phone is v7, but buildozer (via python-for-android) does not support ARMv7.

Apparently the non-v7 library you guys provided works on both v7 and non-v7 chipsets.

Now I have couchbase-lite from python!

Woo hoo! Thanks dude.

Traun Leyden

unread,
May 28, 2014, 2:14:42 PM5/28/14
to mobile-c...@googlegroups.com
Sweet!

Care to elaborate on what "couchbase-lite from python" means?


Michael R. Hines

unread,
May 28, 2014, 2:23:03 PM5/28/14
to mobile-c...@googlegroups.com
Ah, yes =).

So, I threw together a python-based server application (with a user
interface) over the last month or two that I didn't want to throw away,
which already uses a NoSQL database on the backend.

So, I wanted to run this python application on my phone, but I didn't
want to re-write the damn thing (and I didn't want to come up with some
cumbersome phone-to-server replication scheme either).

So, I started searching around and came across the
Kivy/Python-for-android projects and managed to get a basic version of
my server program running on my phone.

The last step was searching for a nosql database that could synchronize,
and thus the long, slow march to the wonderful world of couchbase =).

- Michael
Reply all
Reply to author
Forward
0 new messages