进口模块构建Android的错误,gradle这个 - 无法找到方法instrumentTestCompile() [英] Android error on imported module build,gradle - Could not find method instrumentTestCompile()

查看:3820
本文介绍了进口模块构建Android的错误,gradle这个 - 无法找到方法instrumentTestCompile()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在进口 ListViewAnimation 库,我得到重建误差

 错误:(7)出现问题评估项目:图书馆。


  

找不到参数方法instrumentTestCompile()[org.mockito:的Mockito核心:1.9.5,build_n73cqp2judtlhpna5h10rio8c $ @ _run_closure1_closure3 20e75be5]项目':库。


这是导入的模块的build.gradle:

 应用插件:Android的图书​​馆
依赖{
    编译com.nineoldandroids:库:2.4.0    instrumentTestCompile('org.mockito:的Mockito核心:1.9.5'){排除组:org.hamcrest'}
    instrumentTestCompile('com.google.dexmaker:dexmaker-的Mockito:1.0'){排除组:org.hamcrest'}
    instrumentTestCompile('的JUnit:JUnit的:4.11'){排除组:org.hamcrest'}
    instrumentTestCompile'org.hamcrest:hamcrest全:1.3'
}安卓{
    compileSdkVersion 19
    buildToolsVersion '19 .0.1    sourceSets {
        主要{
            manifest.srcFile'的Andr​​oidManifest.xml
            java.srcDirs = ['src'中]
            resources.srcDirs = ['src'中]
            res.srcDirs = ['水库']
            assets.srcDirs = ['资产']
        }        instrumentTest.setRoot(测试)
        instrumentTest {
            java.srcDirs = ['测试/ Java的']
        }
    }    defaultConfig {
        8的minSdkVersion
        targetSdkVersion 19
        project.VERSION_NAME的versionName
        版本code的Integer.parseInt(新的Date()。格式('YYYYMMDDHH'))
    }    packagingOptions {
        排除的LICENSE.txt
    }
}从适用:../maven_push.gradle

这是什么问题?


解决方案

instrumentTest 的已的 androidTest 的最近Android的gradle这个-插件更名

您已经在的build.gradle重命名:


  • instrumentTestCompile 的 - > androidTestCompile

  • instrumentTest 的 - > androidTest

On import ListViewAnimation library, I get rebuild error

Error:(7) A problem occurred evaluating project ':library'.

Could not find method instrumentTestCompile() for arguments [org.mockito:mockito-core:1.9.5, build_n73cqp2judtlhpna5h10rio8c$_run_closure1_closure3@20e75be5] on project ':library'.

This is the imported module build.gradle:

    apply plugin: 'android-library'


dependencies {
    compile 'com.nineoldandroids:library:2.4.0'

    instrumentTestCompile ('org.mockito:mockito-core:1.9.5')  { exclude group: 'org.hamcrest' }
    instrumentTestCompile ('com.google.dexmaker:dexmaker-mockito:1.0')  { exclude group: 'org.hamcrest' }
    instrumentTestCompile ('junit:junit:4.11')  { exclude group: 'org.hamcrest' }
    instrumentTestCompile 'org.hamcrest:hamcrest-all:1.3'
}

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.1'

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        instrumentTest.setRoot('tests')
        instrumentTest {
            java.srcDirs = ['tests/java']
        }
    }

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
        versionName project.VERSION_NAME
        versionCode Integer.parseInt(new Date().format('yyyyMMddHH'))
    }

    packagingOptions {
        exclude 'LICENSE.txt'
    }
}

apply from: '../maven_push.gradle'

What is the problem ?

解决方案

instrumentTest has been renamed in androidTest in recent android-gradle-plugin

You have to rename in the build.gradle :

  • instrumentTestCompile --> androidTestCompile
  • instrumentTest --> androidTest

这篇关于进口模块构建Android的错误,gradle这个 - 无法找到方法instrumentTestCompile()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆