{"id":29554678,"url":"https://github.com/sbrunk/jena-android","last_synced_at":"2025-07-18T07:33:07.656Z","repository":{"id":27482549,"uuid":"30962444","full_name":"sbrunk/jena-android","owner":"sbrunk","description":"This project aims to make the Apache Jena Framework usable on Android","archived":false,"fork":false,"pushed_at":"2015-04-15T12:37:41.000Z","size":360,"stargazers_count":16,"open_issues_count":1,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-14T16:55:58.875Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbrunk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-18T11:13:32.000Z","updated_at":"2023-12-08T15:43:11.000Z","dependencies_parsed_at":"2022-09-10T06:00:43.141Z","dependency_job_id":null,"html_url":"https://github.com/sbrunk/jena-android","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sbrunk/jena-android","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbrunk%2Fjena-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbrunk%2Fjena-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbrunk%2Fjena-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbrunk%2Fjena-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbrunk","download_url":"https://codeload.github.com/sbrunk/jena-android/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbrunk%2Fjena-android/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265720472,"owners_count":23817242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-18T07:31:01.592Z","updated_at":"2025-07-18T07:33:07.632Z","avatar_url":"https://github.com/sbrunk.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Apache Jena for Android\n\nThis project aims to make the [Apache Jena](http://jena.apache.org/) Framework usable on Android. While Jena is written in pure Java, it can't be used on Android as is, due to multiple package conflict issues. To overcome these issues, we have created an Android Port enabling developers to use Apache Jena in Android apps. In contrast to other ports we don't just publish binaries, but make the Maven build files of the port available. We also stay as close as possible to the original (i.e. no source code changes).\nThis should make it easier to stay in sync with upcoming Jena releases.\n\nThe Android Port was created at the [Junior Professorship in Software Engineering of Ubiquitous Systems (SEUS)](http://seus.inf.tu-dresden.de/) at the Faculty of Computer Science at the TU Dresden.\n\n## Background\nThe main issue is that Jena contains code that refers to classes from the javax.xml namespace that aren't part of the Dalvik Virtual machine. The classes are actually provided by [xerces](https://xerces.apache.org/) but the dalvik compiler refuses to build anything in core java namespaces as it could, in theory, be added to future Android versions causing conflicts. You could use the `--core-library` option of the dex tool, but according to the dex documentation:\n   \n\u003e the path you are on will ultimately lead to pain, suffering, grief, and lamentation.\n   \nIt's also not very portable as everyone has to change the arguments to the dexer.\n\nA similar issue is caused by a version conflict in the Apache [httpclient](https://hc.apache.org/httpcomponents-client-ga/index.html) library because Android ships a ancient version of it but Jena currently requires version 4.2. The [httpclient website](https://hc.apache.org/httpcomponents-client-4.3.x/android-port.html) has more information about it.\n\nThe solution is to relocate all elements from conflicting namespaces to a different package and change all code referencing those elements accordingly. Fortunately, there are tools for doing that automatically. We use the [Maven Shade](https://Maven.apache.org/plugins/Maven-shade-plugin/) plugin for that, specifically the [relocation feature](https://Maven.apache.org/plugins/Maven-shade-plugin/examples/class-relocation.html).\n\nExternal dependencies that rely on things from conflicting namespaces are shaded into modified jars (xerces and httpclient at the moment). The modules that depend on them are rewritten so they depend on the modified version while the dependencies on the original libraries are removed.\nInternal dependencies of the Jena modules are overwritten as well, so jena-android-arq (containing the shaded jena-arq) depends on jena-android-core instead of jena-core directly.\nAll other dependencies are **not** included but are kept as dependency in the modified pom file.\n\n## Usage\n\nCreate modified Jena packages:\n\n```bash\n$ cd jena-android\n$ mvn install\n```\n\nThis will install modified Jena packages that run on Android into your local Maven repository. At the moment it creates packages for the following Jena modules:\n\n * jena-core\n * jena-arq\n * jena-iri\n * jena-tdb\n * jena-spatial\n * jena-text\n\nThe modified modules are called jena-android-core, jena-android-arq etc.\n\n### Managed Dependencies\nIf you use a build tool with dependency management such as Gradle, Maven or SBT, you can now just add a dependency to one of the libraries in your Android project.\nE.g. if you use gradle add the following to your build.gradle:\n\n```groovy\nrepositories {\n    ...\n    MavenLocal()\n}\n\ndependencies {\n    ...\n    compile 'mobi.seus.jena:jena-android-arq:2.13.0'\n}\n\n// we have to exclude a few files here that appear in multiple libraries\npackagingOptions {\n    exclude 'META-INF/LICENSE'\n    exclude 'META-INF/NOTICE'\n    exclude 'META-INF/DEPENDENCIES'\n    exclude 'META-INF/LICENSE.txt'\n    exclude 'META-INF/NOTICE.txt'\n}\n```\n\nIf your want to pull in all Jena libraries you should add a dependency on jena-android-jars.\n\nCurrently the artifacts are not deployed to a public repository. If you want to use them in a team you should deploy them to your own Maven repository or add the jars as unmanaged dependencies.\n\n### Unmanaged Dependencies\n\nIf you don't use a tool for dependency management, you can also create jars including their dependencies with the following command:\n\n```bash\n$ cd jena-android\n$ mvn package dependency:copy-dependencies\n```\nFor each module this will create a file called `target/module-name.jar` and copy all transitive dependencies into the `target/dependencies/` directory of that module.\n\nNow copy the module jar and the dependency jar into the libs folder of your Android project.\n \nE.g. for jena-android-arq you have to copy `jena-android-arq/target/jena-android-arq-2.12.1.jar` and the content from `jena-android-arq/target/dependencies/` to your Android Project. Some of the modules like jena-android-text don't create their own jar. In that case it's enough to just copy the dependencies.\n\n### How to deal with the Dalvik 64K Method Limit\n\nJena and its dependencies reference a lot of methods, so you will probably reach the 64K method limit for Android's dex files quite soon. \nYou will get an error message like the following during compilation:\n\n\u003e Unable to execute dex: method ID not in [0, 0xffff]: 65536\n\u003e Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536\n\nTo work around this limitation, you either have to:\n\n  1. Run Proguard on every build (even on development builds).\n  2. Use the new multi dex class loader that is available since Android 5.0. See https://developer.android.com/tools/building/multidex.html for details.\n  \nHave a look at the example project to see how it can be done.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbrunk%2Fjena-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbrunk%2Fjena-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbrunk%2Fjena-android/lists"}