I was trying Kotlin Gradle Script and Android Testing.

When I try to configure android resource for Testing I get the following error :

Cannot access includeAndroidResource It is private in UnitTestOptions.

enter image description here

What is the proper way to enable using android Resource in Android Unit testing?

1 Answers

0
erluxman On

After posting this question, I went back to Android Studio and tried to see what's there for autocomplete. I pressed Control+Space just after testOptions.unitTests. and boom, there was the option called isIncludeAndroidResources which was kotlin getter in TestOptions class for

private includeAndroidResource 

which I then set to true.

Solution :

 testOptions.unitTests.isIncludeAndroidResources = true

Lesson: Try to write a question to explain the problem, sometimes answer is inside your own head.