Separate androidTest sourceSet for different buildType NOT build flavor

会有一股神秘感。 提交于 2019-12-25 02:33:16

问题


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!

来源:https://stackoverflow.com/questions/56112541/separate-androidtest-sourceset-for-different-buildtype-not-build-flavor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!