Running a Multidexed Espresso .APK

后端 未结 1 1456
孤独总比滥情好
孤独总比滥情好 2021-01-14 04:22

When running Espresso tests with ./gradlew connectedDebugAndroidTest, we\'re having this issue:

com.android.build.api.transform.Transform

相关标签:
1条回答
  • 2021-01-14 04:34

    The task connectedDebugAndroidTest will try to build test apks for every module in the project, so if you project has multiple modules, you need to enable multidex in every one of them. This is usually done setting

    android.defaultConfig.multiDexEnabled true
    

    in build.gradle for each module.

    You could skip all of this for modules that don't have any tests if you just don't try to execute the task in those. e.g, if only the app module has instrumentation tests, you could execute app:connectedDebugAndroidTest instead to avoid the possible multidex errors. This is actually what the run configuration created by Android Studio does by default, and probably the reason why your tests are running just fine when you launch them form the IDE.

    0 讨论(0)
提交回复
热议问题