Android gradle src/androidTest/res/layout/mylayout.xml not found in mypackage.R
For me, the solution was to put the source files in src/androidTest/java
and the resource files in src/androidTest/res
. Those are the standard locations, so you don't need to edit anything in gradle.build
.
Plus, rename your R import from
import com.mycompany.myappname.R;
to
import com.mycompany.myappname.test.R;
I found the solution, add this to your build.gradle file.
sourceSets { androidTest { java.srcDirs = ['src/androidTest/src'] resources.srcDirs = ['src/androidTest/src'] }}