简体   繁体   中英

How to use jena ontology api on android?

I am new at this area. I have built an ontology project on eclipse by using jena. However, I would like to use it on Android. I have found the androidjena, and follow the instruction here My android app's minSdkVersion 21. I download the Jena modules and put then in D:\\myproject.gradle

After I add this on build.gradle:

allprojects {
    repositories {
        google()
        jcenter()
        MavenLocal()
    }
}

dependencies {
    ...
    implementation 'mobi.seus.jena:jena-android-arq:2.13.0'
}
android {
    ...
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
}

Then I synced the project, here comes an error

Could not find method MavenLocal() for arguments [] on repository container

Did I missed anything ? or I put the Jena modules to the wrong place? Please help found out what the problem is. Thank you!

Problem #1 - According to the instruction on the page you linked to, you should add MavenLocal() to the repositories section of the build.gradle file. You don't appear to have done that.

CORRECTION - according to the example in the Gradle manual on page 460 1 it should be mavenLocal() . I think that Gradle is case sensitive. If it is, then the Jena instructions are at fault.

Problem #2 - And according to the instructions it is supposed to say "compile" ... but I gather that changed in gradle 3.0

Problem #3 - The instructions also say:

Currently 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.

Have you done that? Or have you done the following instead?

Create modified Jena packages:

 $ cd jena-android $ mvn install 

This will install modified Jena packages that run on Android into your local Maven repository.

The point is that you can't just tell Maven / Gradle to pull the Jena artifacts from a public Maven repo. The artifacts must be built and installed into your local repo and (if you are working in a team) pushed to your (typically private) team repo.


1 - ... or search for "Using init script to perform extra configuration before projects are evaluated".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM