testCompile导致Android的工作室不依赖解析 [英] testCompile results in Android studio not resolving dependencies

查看:383
本文介绍了testCompile导致Android的工作室不依赖解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的MainProject /项目/ src目录/试验测试。我使用的杰克沃顿gradle这个-Android的测试插件。每当我指定与testCompile的依赖,它不会自动完成的IDE。但它确实编译。

I have my tests in MainProject/Project/src/test. I am using Jake Wharton's gradle-android-test-plugin. Whenever I specify a dependency with testCompile, it doesn't auto-complete in the IDE. But it does compile.

我的build.gradle看起来是这样的:

my build.gradle looks like this:

buildscript {
    repositories {
        mavenCentral()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.+'
        classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT'

    }
}
apply plugin: 'android'
apply plugin: 'android-test'


repositories {
    mavenCentral()
}

dependencies {

    testCompile 'junit:junit:4.11'

}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"
}

但每当我试图code将其做到这一点:

but whenever I try to code it does this:

这是烦人,我descreases生产力。任何建议如何解决这个问题?谢谢你。

It is annoying and descreases my productivity. Any suggestions on how to resolve this? Thanks.

推荐答案

我有同样的问题。我的临时解决方案是重复testCompile依赖于instrumentTestCompile。

I've had the same problem. My temporary solution is to repeat the testCompile dependencies in instrumentTestCompile.

这种方式,在Android工作室识别instrumentTestCompile依赖关系,并开始自动完成。

This way, the Android Studio recognises the instrumentTestCompile dependencies and starts auto-completing.

这篇关于testCompile导致Android的工作室不依赖解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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