I’m trying to incapsulate android plugin in my own plugin, but when I’m trying to apply my plugin build fails with an exception:
A problem occurred evaluating root project ‘myproj’. > Failed to apply plugin [id ‘com.mycomp.build’]
Failed to apply plugin [id ‘android-library’]
Plugin with id ‘android-library’ not found. Here is how I’m applying android plugin inside my own plugin’s implementation:
// build.gradle apply plugin: ‘groovy’
version = ‘1.0’ group = ‘com.mycomp’
dependencies {
compile gradleApi()
compile localGroovy() }
// Build.groovy package com.mycomp
import org.gradle.api.Plugin import org.gradle.api.Project
class Build implements Plugin {
void apply(Project project) {
println ‘Hello from com.mycomp.Build’
project.beforeEvaluate {
buildscript.configurations.classpath +=
‘com.android.tools.build:gradle:1.0.0-rc1’
}
project.configure(project) {
buildscript.repositories.mavenCentral()
apply plugin: ‘android-library’
}
} } For some reason a classpath is not being properly loaded, what am I doing wrong?