I'm trying to automate my projects with Gradle.
I have several apps and one library project. After having read carefully the official doc, this is a simplified view of my build.gradle:
buildscript {
repositories {
mavenCentral()
maven {
url "http://saturday06.github.io/gradle-android-scala-plugin/repository/snapshot"
}
}
dependencies {
// 0.8.3 con Gradle 1.10
classpath 'org.gradle.api.plugins:gradle-android-plugin:1.2.1'
}
}
apply plugin: 'idea'
project(':MyApp') {
ext.apl = true
}
project(':MyLibrary') {
ext.apl = false
}
subprojects {
if (project.apl) {
apply plugin: 'android'
dependencies {
compile 'ch.acra:acra:4.5.0'
}
}
if (project.scala) {
apply plugin: 'android-scala'
scala {
target "jvm-1.7"
addparams '-feature'
}
} else {
apply plugin: 'android-library'
}
android {
compileSdkVersion 17
buildToolsVersion '19.1.0'
signingConfigs { ... }
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}
sourceSets {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
debug {
runProguard false
proguardFile file('proguard-rules.txt')
signingConfig signingConfigs.depurar
}
release {
runProguard true
proguardFile file('proguard-rules.txt')
signingConfig signingConfigs.entregar
}
}
}
}
project(':MyLibrary') {
dependencies {
compile "com.github.tony19:logback-android-core:1.1.1-2"
compile "com.github.tony19:logback-android-classic:1.1.1-2"
compile "org.slf4j:slf4j-api:1.7.6"
}
}
project(':MyApp') {
dependencies {
compile 'com.android.support:appcompat-v7:19.1.0'
compile('org.apache.httpcomponents:httpmime:4.1.1') {
transitive = false
}
compile project(':Bibl')
}
}
My settings.gradle is:
include 'MyLibrary', 'MyApp'
There is only one build.gradle.
The problem is that Gradle complains that
Plugin with id 'android-library' not found
whenever I try to use this plugin. With apply plugin: 'android' there is no problem.
The documentation states clearly that for libraries 'android-library' must be used. I'm using Gradle 1.10.
Is the doc outdated for newest versions of gradle-android-plugin like 1.2.1? Because the official doc is for version 0.9.
Is the doc outdated for newest versions of gradle-android-plugin like 1.2.1?
Quoting the documentation for gradle-android-plugin
:
We are very sorry to announce that development of this plugin has been discontinued. Google has created their own Android development toolchain based on Gradle, which supercedes this plugin.
Please see http://tools.android.com/tech-docs/new-build-system/user-guide for further information.
I usually associate android-library
with the official Gradle for Android plugin; I have no idea if the deprecated gradle-android-plugin
supports it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With