android - Gradle 找不到插件

标签 android android-studio gradle 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.+'
}

我得到的错误是:

Error:(6, 0) Plugin with id 'testfairy' not found.

急于修复它?

最佳答案

我的猜测是您仅在应用程序的存储库闭包中添加了 TestFairy 依赖项。构建脚本应该有另一个存储库 block ,在我的项目中它位于根 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
    }

}

这让您可以为构建依赖项和应用程序依赖项定义彼此分开的存储库。

关于android - Gradle 找不到插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25176550/

相关文章:

安卓 eclipse : Customizing the build process

android-studio - 无法在 android studio 1.0 上启动 avd 模拟器

java - Android 压缩纹理加载(缺少 GL 扩展)

android - 将 Java 类作为函数参数发送

android-studio - 如何解决gradle; “contains too many directories after formatting system”

android - java.lang.ClassNotFoundException : Didn't find class "com.google.android.things.pio.PeripheralManagerService" 异常

java - Scala/Gradle 的 build.gradle 中包含什么

java - BeanCreationException : Cannot determine embedded database driver class for database type NONE

android - 更新后 android studio 无法为锁定文件创建父目录

Android geocoding api 无法返回地址