小编Car*_*ker的帖子

如何使用android gradle plugin实验0.1.0添加测试依赖项

我按照指南在Android Studio 1.3.0 RC1上使用gradle-experimental:0.1.0构建了一个ndk混合项目.

一切都很好,但如果我尝试添加测试库依赖项,我发现该方法androidTestCompile不再受支持.像这样:

错误:找不到DSL方法

并且testCompile还会导致同样的错误.

官方指南没有谈到这一点.那么,我该如何添加添加测试依赖性gradle-experimental或者这个版本不支持这个功能呢?

这是我的build.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-experimental:0.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
Run Code Online (Sandbox Code Playgroud)

这是build.gradle(moudle):

apply plugin: 'com.android.model.application'

model {
    android {
        compileSdkVersion = 22
        buildToolsVersion = "23.0.0 rc3"

        defaultConfig.with {
            applicationId = "co.yishun.onemoment.app"
            minSdkVersion.apiLevel = 15
            targetSdkVersion.apiLevel = 22
            versionCode = 5 …
Run Code Online (Sandbox Code Playgroud)

android build.gradle android-gradle-plugin

7
推荐指数
1
解决办法
1187
查看次数