ericwjr ericwjr - 2 months ago 8
Android Question

Does anyone know how to resolve an ivy dependency in Android Studio?

Here is the repository:
https://asset.opendof.org/

I am trying to add the jar dependency found here:
https://asset.opendof.org/artifact/org.opendof.core-java/dof-oal/7.0.4/jars/

Answer

You will need to configure the repository and layout. Some repositories (like this one) are unique in that they separate artifacts (JARs, ZIPs, etc) from Ivy metadata. You'll have to tell Gradle what the layout (directory structure) of the repository looks like so it knows how to construct the download URLs. For more info see the Gradle documentation on Ivy repositories.

For your specific example you'll want to add the following to your build script:

repositories {
     ivy {
         url 'https://asset.opendof.org'
         layout 'pattern' , {
             artifact 'artifact/[organisation]/[module]/[revision]/[type]s/[artifact](.[ext])'
             ivy 'ivy2/[organisation]/[module]/[revision]/ivy.xml'
         }
     }
 }

dependencies {
    compile 'org.opendof.core-java:dof-oal:7.0.4'
}