Christine
Christine

Reputation: 5575

No assets folder available in Robolectric test

I have been struggling for a while, with the following. In a Robolectric unit test, I use a file in the assets folder to read as mock input. This used to work fine, until a few months ago. I see that the assets folder is not included in the app/build/intermediates folder. I found a work around by pointing the code to the assets folder, hard-coded.

Upvotes: 2

Views: 221

Answers (1)

Christine
Christine

Reputation: 5575

In another project, created recently, I found that there is an assets folder in the build dir structure. After experimenting with various parameters, I found that the bug (if it's a bug) is in the Android version or build tools version. Upgrading from

android {
   compileSdkVersion 23
   buildToolsVersion "23.0.2"
   ...

to

android {
   compileSdkVersion 25
   buildToolsVersion "25.0.1"
   ...

resolved the issue.

Upvotes: 1

Related Questions