Gradle: plugin with id 'android-library' not found

I am trying to automate my projects using Gradle.

I have several applications and one library project. After you carefully read the official white paper , this is a simplified view of my build.gradle:

buildscript {
    repositories {
        mavenCentral()
        maven {
            url "http://saturday06.imtqy.com/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 .gradle settings:

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. Using the plugin: "android" no problem.

The documentation clearly states that for libraries android-library must be used. I am using Gradle 1.10.

Is doc deprecated for the latest gradle -android-plugin versions as 1.2.1? Because the white paper is for version 0.9.

+4
1

doc gradle -android-plugin 1.2.1?

gradle-android-plugin:

, . Google Android Gradle, .

. http://tools.android.com/tech-docs/new-build-system/user-guide.

android-library Gradle Android; , gradle-android-plugin.

+2

Source: https://habr.com/ru/post/1543198/


All Articles