Downloads

Several time ago we were involved in a project using ontologies on Android-based mobile devices. We firstly tried the Androjena project (http://code.google.com/p/androjena/) but it's development is almost ceased and it supports only a subset of the Jena features. Therefore we tried to use the full Apache Jena project on Android. While the project is not directly working, we analyzed the issues and we came out with a fully working copy of Apache Jena on Android.


We think that the process for getting Apache Jena working on Android might be of interest for the development community of Apache Jena and Android. More specifically we would like to inform you about the issues preventing direct adoption of Apache Jena in Android and the solution we applied, hoping that they might be integrated in the full Jena release in a near future.

You can find a Jena version working on Android (4.x)  here:

  1. elite.polito.it/files/releases/jena/jena-core-2.7.3.jar
  2. elite.polito.it/files/releases/jena/jena-iri-0.9.3.jar
  3. elite.polito.it/files/releases/jena/xercesImpl-repack.jar
  4. elite.polito.it/files/releases/jena/slf4j-android-1.6.1-RC1.jar


while in the following we describe the issue preventing direct adoption of Apache Jena in Android.

The Apache Jena framework defines some packages (mostly inherited from dependencies, xerces, in particular) by using the namespace javax.* . Such a namespace is currently interpreted by the Dalvik cross-compiler as belonging to the "core" java library, thus not being "safe" to cross-compile. The result is that the code containing such packages is not cross-compiled unless the compiler is set in "core-library" mode which results in a compiled code that will probably cease working after system updates and that, as the cross-compiler warns, " will ultimately lead to pain, suffering, grief, and lamentation."

Actually the packages are not part of the java core library therefore a simple re-factoring solves the problem. In the specific case, we downloaded the last sources of xerces, refactored all javax.*  packages to javax2.* and re-packed the library, and everything worked perfectly. This, by the way, enables the full Apache Jena framework on Android, with the ability for developers to just include the needed modules as it is currently done in typical Java applications.