I trying to add Android Support Instrumentation test to my application, but i run this problem: Cannot resolve symbol 'AndroidJUnit4'
Its seems i don't have the package android.support.test.runner
my app's build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "---PACKAGENAME---"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
debug {
storeFile file("../keys/debug.jks")
storePassword "*"
keyAlias "debug"
keyPassword "*"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug_uat {
debuggable true
signingConfig signingConfigs.debug
}
debug_int {
debuggable true
signingConfig signingConfigs.debug
}
staging {
debuggable false
signingConfig signingConfigs.debug
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(path: ':volley')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
androidTestCompile 'com.android.support:support-annotations:23.4.0'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
}
The gradle sync and the build is ok, but i can not add the support AndroidJUnitRunner to my run config and my android test class (the class is in androidTest filder)
Please help! Apoth
UPDATE
I found the problem. I using various build types, and i just needed to add testBuildType "debug_uat"
to my build.gradle.