首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gradle Spoon:找不到id为'spoon‘的插件

Gradle Spoon:找不到id为'spoon‘的插件
EN

Stack Overflow用户
提问于 2016-03-11 01:02:32
回答 2查看 1.4K关注 0票数 0

尝试在Android Studio gradle项目中使用spoon框架,但在尝试添加spoon插件时出现错误:

代码语言:javascript
复制
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'
}

错误:找不到id为'spoon‘的(13,0)插件

和:

代码语言:javascript
复制
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命令行对此链接的抱怨:

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

EN

回答 2

Stack Overflow用户

发布于 2016-03-17 01:39:58

您是否注意到您的项目有两个build.gradle文件?我非常确定您添加到一个文件中,这就是您面临的问题

在first build.gradle (应用程序)中,您应该有如下依赖关系:

代码语言:javascript
复制
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'

}

在第二个build.gradle文件(yourApplicationName)中,您应该有:

代码语言:javascript
复制
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
}

希望这能对你有所帮助

票数 2
EN

Stack Overflow用户

发布于 2016-04-25 22:07:09

这对我很有效:

代码语言:javascript
复制
dependencies {
      classpath 'de.felixschulze.gradle:gradle-spoon-plugin:2.7.3' 
}    

apply plugin: 'de.felixschulze.gradle.spoon'    
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35922762

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档