Gradle Spoon: Plugin with id 'spoon' not found

1.6k views Asked by At

Trying to use spoon framework with Android Studio gradle project but getting an error when trying to add spoon plugin :

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

    dependencies {
           classpath 'io.fabric.tools:gradle:1.+'
           classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.0.4'
    }
}

apply plugin: 'android'
apply plugin: 'spoon'
        repositories {
                  maven { url 'https://maven.fabric.io/public' }
}

dependencies {
      androidTestCompile 'com.squareup.spoon:spoon-client:1.3.2'
}

Error:(13, 0) Plugin with id 'spoon' not found

and :

Error:Could not find com.stanfy.spoon:spoon-gradle-plugin:1.0.4.
Searched in the following locations:
file:/C:/Apps/Studio/gradle/m2repository/com/stanfy/spoon/spoon-gradle-   plugin/1.0.4/spoon-gradle-plugin-1.0.4.pom
file:/C:/Apps/Studio/gradle/m2repository/com/stanfy/spoon/spoon-gradle-plugin/1.0.4/spoon-gradle-plugin-1.0.4.jar
https://maven.fabric.io/public/com/stanfy/spoon/spoon-gradle-plugin/1.0.4/spoon-gradle-plugin-1.0.4.pom
https://maven.fabric.io/public/com/stanfy/spoon/spoon-gradle-plugin/1.0.4/spoon-gradle-plugin-1.0.4.jar

gradle command line complaints about this link:

https://maven.fabric.io/public/com/stanfy/spoon/spoon-gradle-plugin/1.0.4/spoon-gradle-plugin-1.0.4.jar

2

There are 2 answers

0
piotrek1543 On

Did you noticed that your project has two build.gradle files? I'm pretty sure you added to one file and that's the problem you're facing

In first build.gradle (app) you should have dependencies like these:

apply plugin: 'com.android.application'
apply plugin: 'spoon'


android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.android.databindingexample"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

    dataBinding {
        enabled = true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:support-v4:23.2.0'

    androidTestCompile 'com.squareup.spoon:spoon-client:1.3.2'

}

In the second build.gradle file (yourApplicationName), you should have:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0-alpha1'
        classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.0.4'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Hope this would help you

0
Testing Singh On

This worked for me:

dependencies {
      classpath 'de.felixschulze.gradle:gradle-spoon-plugin:2.7.3' 
}    

apply plugin: 'de.felixschulze.gradle.spoon'