Gradle找不到插件

Art*_*yan 1 android gradle android-studio testfairy

我正在尝试将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.+'
}
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

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

热修复吗?

Jan*_*usz 5

我的猜测是你只在你的应用程序的存储库关闭中添加了TestFairy依赖项.buildcript应该有另一个存储库块,在我的项目中它位于根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
    }

}
Run Code Online (Sandbox Code Playgroud)

这使您可以为构建依赖关系和应用程序依赖关系定义彼此之间的存储库.