Setting a custom assets directory for unit testing in Android Studio

后端 未结 4 1452
野的像风
野的像风 2021-02-02 08:24

We have the not uncommon requirement of executing unit tests of our Android application which make use of assets which are only required for unit testing.

With the Eclip

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-02 08:55

    I found this right for me

    android{
        sourceSets {
            androidTest {
                assets.srcDirs = ['src/main/assets', 'src/androidTest/assets/', 'src/debug/assets/']
                java.srcDirs = ['src/main/java', 'src/androidTest/java', 'src/debug/java']
            }
        }
    }
    

提交回复
热议问题