Datanucleus and Android


steve@...
 

I have seen rumours of Datanucleus running on Android.  I assumed it would because of SQLite support, but this was a mistake.  Before I switch to a different persistence method, is there any way that Datanucleus does, or can be made to, run on Android?


Andy
 
Edited

I've not tried running on Android, but heard some time ago from one of our contributors (IIRC "nlmarco" from Nightlabs/Codewizards) that they had been doing something about using Android (I think it was around using "SQLDroid" JDBC driver) ... some time ago though. A simple search finds this PullRequest on SQLDroid that the SQLDroid project didn't get around to merging, despite saying all was fine.

Since then I also provided some pull requests to SQLite itself (all merged into recent versions) that made it a runnable database for DataNucleus.

Why not report what problems you have ?


steve@...
 

The issue wasn't the JDBC driver.  It was the use of javax.naming.* packages, and the run-time search for a jar containing the "JDO" api, which isn't included in the .dex packaging for Android.  I have managed to build without the use of javax.naming.*, but I gave up at the api searching. 


Andy
 

Well javax classes not being present in Android's dex stuff kinda limits things (but then they are required by the JDO API), and by "run-time search for a jar containing JDO api" I assume you mean the DN plugin mechanism (searching for MANIFEST.MF and plugin.xml ... uses javax.xml.*). I mailed nlmarco to see if he can remember what they did.


marco@...
 

It's quite a while, but I definitely got DataNucleus running on Android. I wrote a test-program and it worked fine. You already found my pull-request, which fixed quite a few issues in the SQLDroid-driver. I have no idea, if it was ever really merged into the official codebase. https://github.com/cloudstore/cloudstore-experiment here are some old codes which made use of it -- and they worked in the Android-emulator for sure, and IIRC also on my phone back then. Unfortunately, this was never put into productive use, for many reasons -- but not technical ones.


marco@...
 

...and here's another repo that might be interesting: https://github.com/cloudstore/cloudstore-android

The last commit-comments state "cloudstore droid working with DN" and "PersistenceManager can be created!!!" -- so we certainly got it running. I don't remember what we did concerning javax.naming-package(s). Either we added the missing classes to our own dex so that class-loading didn't fail, or we somehow removed references to them. Sorry, don't remember the details, anymore. I only remember that it certainly worked: created tables, wrote and read data.


Andy
 

Looks like you added the missing javax.* classes, as per this.