Android test raw resource

前端 未结 3 786
别那么骄傲
别那么骄傲 2021-01-01 08:31

I have the following folder structure in Android Studio:

├── androidTest
│   ├── java
│   └── res
│       └── raw
│           └── test_file
└── main
    ├──          


        
3条回答
  •  春和景丽
    2021-01-01 09:08

    See Android Unit Tests Requiring Context. For instrumentation test use InstrumentationRegistry.getInstrumentation().getTargetContext() (in Kotlin: getInstrumentation().targetContext). Then you can access resources. You won't need to import R file.

提交回复
热议问题