Extend Android plugin failure

(bogaty_f1) #1

Want to extend android plugin. Here is the code I have started. But AndroidPlugin.class is not recognising! Doing the same thing to JavaPlugin is pretty simple and is works - OK.

apply plugin: CustomPlugin
  buildscript {
    repositories {
      dependencies {
        classpath 'com.android.tools.build:gradle:0.6.1'
        // this is where Android plugin situated.
        classpath 'org.gradle.api.plugins:gradle-android-plugin:1.2.1'
  import com.jvoegele.gradle.plugins.android.AndroidPlugin;
  class CustomPlugin implements Plugin<Project> {
    void apply(Project project) {
          project.task('hello') << {
            println "Hello from the Custom plugin"

error log:

Gradle 'checkJavaPlugin' project refresh failed:
Problem: failed to create task or type gettype
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any / declarations have taken place.
    Build file 'D:\Android plugin\checkJavaPlugin\build.gradle' line: 30
: Gradle settings (show balloon)

(bogaty_f1) #2

Fixed by upgrading Gradle from 1.8 -> 1.10 and 2 lines of code:

classpath 'com.android.tools.build:gradle:0.9.0'