I have android library project and in it I have defined 3 build types: debug, release and integration.

I would like to have additinal androidTest(instrumentation test) directory and additional source directory for integration build type.

I have successfully added source directory: 'my-project/src/integration'

but have failed to add androidTestIntegration directory, android studio is not detecting it in Android project view.

Project build.gradle file:

android {
...
 debug {
 ...
 }
 release {
 ...
 }
 integration {
  ...
  matchingFallbacks = ['debug']
 }
 testBuildType "integration"
}

Project structure:

src/
 main/
  java/
 integration/ -> OK
  java/
 test/
  java/
 androidTest/
  java/
 androidTestIntegration/ -> this one is not being recognized by android studio
  java/

In my android studio in buildVariants window 'integration' variant is selected.

Also

./gradlew my-project:sourceSets

doesnt show androidTestIntegration sourceSet which is the reason I suspect android-studio is not seeing 'androidTestIntegration' directory.

Similar question were already asked but they are not working for me so am not sure if they are correct: short answer detail answer

I would appreaciate any help or guidance on this matter, thx!

0 Answers