I am trying to build an aar file with gradle that has remote dependencies. An example build script is below. As you can see I have two dependencies. The problem I'm having is when I do a release, the aar file does not contain the remote dependencies, so when I include the aar file in other projects I get NoClassDefFound errors.
I found that if I copy the jar from my local maven repo to a libs folder in my project, then the jar does get included in the release aar. How do I include the remote dependencies in the aar file? I've also read elsewhere that it's bad practice to ship dependencies like this, so if there's a better way to do what I'm trying to do I'm all for it.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android-library'
repositories {
mavenCentral()
mavenLocal()
}
android {
... omitted for brevity
}
dependencies {
compile 'com.somepackage:someartifact:1.0'
compile 'com.anotherpackage:artifact:2.0'
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…