I'm very new working with android and dependency management with Gradle. I'm a developer from Java and usually I used Maven to manage the dependencies.
Investigating I found that Gradle is now the dependency management on Android. I usually work with layer on the server side. I did a client project to communicate with the client side that in case is a Android Application. I have to add my client jar as dependency in the Android Project.
Actually I have my local repository with Archiva. In pom.xml usually I declared my local repository in the repositories tag, with this, I can include my projects as dependency.
Is possible do this with Gradle?
I did this, but when I run the project in the android emulator the project fails.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
// Build Configuration
buildscript {
// Repositories
repositories {
mavenLocal()
mavenCentral()
}
// Dependencies
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
// Android Plugin
//apply plugin: 'android'
apply plugin: 'android-library'
// Repositories
repositories {
mavenLocal()
mavenCentral()
}
// Dependencies Configuration
dependencies {
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.2'
**compile 'com.project:myproject-client:1.0.0'**
}
// Android Configuration
android {
buildToolsVersion '20.0.0'
compileSdkVersion 20
sourceSets {
main {
manifest {
srcFile 'app/src/main/AndroidManifest.xml'
}
java {
srcDir 'app/src/main/java'
}
res {
srcDir 'app/src/main/res'
}
/*assets {
srcDir 'assets'
}*/
resources {
srcDir 'app/src/main/resources'
}
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
lintOptions {
// simple xml fails lint checks because it references javax.xml.stream
abortOnError false
}
}