I have a library that is split into two maven artifacts:
'com.stubworld.core:CorelibJava:1.0'
'com.stubworld.core:CorelibAndroid:1.0'
The CorelibJava artifact is built by a
build.gradle script that uses the java gradle plugin, and is pure java with no android dependencies. The maven artifact is a jar and here is the
pom file.
The CorelibAndroid artifact is built by a
build.gradle script that uses the android-library gradle plugin, and depends on the CorelibJava maven artifact. The maven artifact is an aar and here is the
pom file.
I tried to use these libraries from an Android project which uses the 'android' gradle plugin, and after some tweaking I managed to get it to work with the following dependencies:
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.stubworld.core:CorelibJava:1.0'
compile 'com.stubworld.core:CorelibAndroid:1.0@aar'
}
However, I wasn't really clear on a few things:
* Why do I specifically need to reference the 'com.stubworld.core:CorelibJava:1.0' artifact? Shouldn't that be automatically resolved since it's an upstream dependency of the 'com.stubworld.core:CorelibAndroid:1.0@aar' artifact?
* Why is the @aar qualifier needed on the 'com.stubworld.core:CorelibAndroid:1.0@aar' artifact? I have other projects that depend on .aar maven artifacts, and I never needed to add "@aar".
Basically I expected the dependencies to look like this:
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.stubworld.core:CorelibAndroid:1.0'
}
and just want to make sure I'm doing things right.