5

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?

erluxman
  • 18,155
  • 20
  • 92
  • 126

1 Answers1

12

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.

erluxman
  • 18,155
  • 20
  • 92
  • 126