Gradle can not find plugin

5.7k Views Asked by At

I'm trying to integrate TestFairy with my project. I use Android Studio 0.8.2 Beta.

Official site: http://testfairy.com/

There is an example how it works: https://github.com/testfairy/testfairy-gradle-plugin

This is my 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.+'
}

The error I get is:

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

Hot to fix it?

1

There are 1 best solutions below

0
On BEST ANSWER

My guess is that you added the TestFairy dependency in the repository closure of you app only. There should be another repositories block for the buildscript, in my project it is in the root gradle file and looks like this:

// 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
    }

}

This lets you define repositories for the build dependencies and app dependencies apart from each other.