Gradle找不到插件。

3

我正在尝试将TestFairy与我的项目集成。 我使用的是Android Studio 0.8.2 Beta。

官方网站: http://testfairy.com/

这是一个演示它如何工作的例子:https://github.com/testfairy/testfairy-gradle-plugin

这是我的build.gradle文件:

repositories {
    maven { url 'http://clinker.47deg.com/nexus/content/groups/public';; }
    maven { url 'https://www.testfairy.com/maven';; }
}
apply plugin: 'com.android.application'
apply plugin: 'testfairy'
android {
    compileSdkVersion 19
    buildToolsVersion '20.0.0'
    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    productFlavors {
    }
    testfairyConfig {
        apiKey "Here is my real api key"
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'
    compile 'org.roboguice:roboguice:2.0'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.android.support:support-v4:19.+'
    compile 'com.google.android.gms:play-services:4.2.42'
    compile 'se.emilsjolander:stickylistheaders:2.3.0'
    classpath 'com.testfairy.plugins.gradle:testfairy:1.+'
}

我遇到的错误是:

错误:(6, 0)找不到id为'testfairy'的插件。

如何解决?

嗨,Artur,你能否请将标签“testfairy”添加到这个问题中?谢谢。 - gilm
1个回答

6
我的猜测是,你只在应用程序的存储库闭包中添加了TestFairy依赖项。 在buildscript中应该有另一个repositories块,在我的项目中它在根gradle文件中,看起来像这样:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'

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

}

这使您能够将构建依赖项和应用程序依赖项的存储库分开定义。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接