添加apply plugin:' org.robolectric' in(app)gradle文件显示项目刷新失败错误:不支持Android Gradle插件2.1.2

时间:2016-10-05 11:06:20

标签: android android-gradle build.gradle robolectric robolectric-gradle-plugin

嗨我试图在android studio中配置Jenkins。我遵循了link

并且我在MAC系统中安装了Jenkins并使用我的localhost进行了验证,以检查其运行是否完美(如上面的链接中所述)。

我在项目(root)依赖项中添加了以下行。

classpath' org.robolectric:robolectric-gradle-plugin:1.0.1'

我更新的项目.gradle文件是

 dependencies {
    classpath 'com.android.tools.build:gradle:2.1.2'
    classpath 'org.robolectric:robolectric-gradle-plugin:1.0.1'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

No issues while sync project .gradle file. 

但问题在更新(添加robolectric)app .gradle文件

后开始
apply plugin: 'com.android.application'
apply plugin: 'org.robolectric'

这给了我以下错误消息

Gradle 'CreatrixAndApp' project refresh failed
Error:The Android Gradle plugin 2.1.2 is not supported.

这是我的项目根.gradle文件

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'org.robolectric:robolectric-gradle-plugin:1.0.1'
    }
}


allprojects {
    repositories {
        jcenter()
    }
}

这是我的应用.gradle文件

apply plugin: 'com.android.application'
apply plugin: 'org.robolectric'

buildscript {

    repositories {
        mavenCentral()
    }

    dependencies {
         classpath 'com.android.tools.build:gradle:2.1.2'
    }
}


repositories {

    mavenCentral()

    maven {
       url "${System.env.HOME}/.m2/repository"
    }

    flatDir {
       dirs 'libs'
    }

}

android {

    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId 'com.creatrixhrm'
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 20160615
        versionName "1.6.0"
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
        }
    }

    productFlavors {
    }

    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = false
    }

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':photoViewerLibrary')
    compile project(':multipleImagePick')
    compile(name: 'creatrixone1_1', ext: 'aar')
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:cardview-v7:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:support-vector-drawable:23.3.0'
    compile 'com.android.support:animated-vector-drawable:23.3.0'
    compile 'com.koushikdutta.ion:ion:2.1.7'
    compile 'mbanje.kurt:fabbutton:1.2.2@aar'
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'io.jsonwebtoken:jjwt:0.6.0'
}

我尝试了this建议,但没有使用

任何人都可以告诉我我在哪里犯错误

0 个答案:

没有答案