Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot access includeAndroidResource It is private in UnitTestOptions

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?

like image 740
erluxman Avatar asked Mar 04 '23 00:03

erluxman


1 Answers

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.

like image 157
erluxman Avatar answered Apr 06 '23 01:04

erluxman