I recently installed the latest google tools for my Android project:
buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.1.0' } } allprojects { repositories { jcenter() } } apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion "21.1.2" compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { applicationId "com.xxx" minSdkVersion 10 targetSdkVersion 21 versionCode 200 versionName "2.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } signingConfigs { debug { ... } release { ... } } buildTypes { release { ... } debug { ... } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.3' // ---- Tests with robolectric testCompile 'com.google.guava:guava:14.0.1' testCompile 'junit:junit:4.+' testCompile 'org.robolectric:robolectric:2.4' testCompile 'org.mockito:mockito-all:2.0.2-beta' // ---- Tests with Espresso androidTestCompile ('com.android.support.test.espresso:espresso-core:2.0') { exclude module: 'hamcrest-core' } androidTestCompile 'org.hamcrest:hamcrest-core:1.1' androidTestCompile 'org.hamcrest:hamcrest-integration:1.1' androidTestCompile 'org.hamcrest:hamcrest-library:1.1' androidTestCompile ('com.android.support.test:testing-support-lib:0.1') { exclude module: 'hamcrest-core' } androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.0' androidTestCompile('junit:junit-dep:4.10') { exclude module: 'hamcrest-core' } }
Where before I used com.github.jcandksolutions.gradle:android-unit-test:2.1.1 to run my robolectric tests in jvm. As google says for its new build tools: "New source folders recognized by unit tests: src / test / java, src / testDebug / java, src / testMyFlavor / java, etc." But, as you can see below, my test folder is not recognized as the source folder. It worked with com.github.jcandksolutions.gradle:android-unit-test:2.1.1 , but no more with the new build tools:

What am I missing here? Thanks you
android android-gradle robolectric build-tools android-build
E-kami
source share