3

I am trying to use Qi4j with Android but I have problems defining the dependenciy because the gradle "runtime"-dependency does not exist on android.

According to the qi4j website, the dependencies should look like this:

repositories {
    // ...
    mavenRepo name: 'qi4j-releases', url: "https://repository-qi4j.forge.cloudbees.com/release/"
    mavenRepo name: 'qi4j-snapshots', url: "https://repository-qi4j.forge.cloudbees.com/snapshot/"
    // ...
}
dependencies {
    // ...
    compile "org.qi4j.core:org.qi4j.core.bootstrap:QI4J_VERSION"
    runtime "org.qi4j.core:org.qi4j.core.runtime:QI4J_VERSION"
    test    "org.qi4j.core:org.qi4j.core.testsupport:QI4J_VERSION"
    // ...
}

Because "runtime" does not exist in the gradle android-plugin, I've changed it to "apk":

dependencies {
    compile "org.qi4j.core:org.qi4j.core.bootstrap:2.0"
    apk "org.qi4j.core:org.qi4j.core.runtime:2.0"
}
But I am still getting errors when I am trying to user some library functions in Android Studio.

What is the right way to import this for android?

eskatos
  • 4,174
  • 2
  • 40
  • 42
McFarlane
  • 1,777
  • 2
  • 22
  • 39
  • 1
    Qi4j is not yet supported on the Android Dalvik VM. See http://ops4j1.jira.com/browse/QI-348 – eskatos Feb 10 '14 at 21:53
  • Simply add org.qi4j.core.runtime as a compile dependency. Having it in a different scope is only to enforce you don't import anything from Qi4j Core Runtime in your Application Code. This should solve your gradle/ide issues but won't work, yet, see my previous comment. – eskatos Feb 10 '14 at 21:54
  • You should also provide a stacktrace if you get one, at least an error message. – eskatos Feb 10 '14 at 21:56
  • Ah that's sad. The ticket wasn't updated for two years, so they probably won't fix this in the near future. Thanks for your comments. Btw setting the scope to "compile" still didn't make Anroid Studio include the dependencies. – McFarlane Feb 11 '14 at 07:35
  • I just edited the ticket :) Android support would be awesome. Qi4j 2.0, a complete rewrite, was released in 2013. The project is now headed towards 2.1 adding new features. Contributions are welcome! – eskatos Feb 17 '14 at 14:18
  • If you are curious, I set up a sample application, see https://github.com/eskatos/qi4j-android-sample-app I had no issue with Android Studio and dependencies. Note that you have to refresh the Gradle project after every dependency changes. – eskatos Feb 20 '14 at 09:52
  • Qi4j is now Apache Zest. http://zest.apache.org and the bytecode generation should be pluggable in 3.0, and we welcome anyone to help out in the Android effort. See https://issues.apache.org/jira/browse/ZEST-50 – Niclas Hedhman Dec 12 '15 at 02:24
  • **Update 2022;** Apache-Polygene is the new name, and the final, as the project was discontinued, see: https://attic.apache.org/projects/polygene.html (but their latest-source-code may support Android, did not test v3.0) – Top-Master Jun 01 '22 at 15:54

0 Answers0