Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

testCompile results in Android studio not resolving dependencies

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.

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

but whenever I try to code it does this:

enter image description here

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

like image 749
Johnny Z Avatar asked Mar 22 '23 17:03

Johnny Z


1 Answers

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

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

like image 121
Fernando Camargo Avatar answered Apr 06 '23 16:04

Fernando Camargo