Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support test-scope resources #2134

Closed
jcogilvie opened this issue Nov 9, 2015 · 1 comment
Closed

Support test-scope resources #2134

jcogilvie opened this issue Nov 9, 2015 · 1 comment

Comments

@jcogilvie
Copy link

Android has a little bit of support for this baked in, by way of the androidTest instrumentation tests. Anything in src/androidTest/res gets built into com.mypackage.test.R.java (alongside com.mypackage.R.java for production) when you run the gradle task compileDebugAndroidTestSources.

If you do this, you get a set of intermediate directories with androidTest as the build flavor.

See my StackOverflow question and answer here for the kind of changes I had to make to the robo gradle test runner to make it halfway work.

I think that we should have something gradle-wise that forces a build of test.R.java and ensures we load the correct resources.

(In my own personal case I've mapped src/test/res into the androidTest sourceSet's res folders for consistency's sake, but out-of-the-box it looks in src/androidTest/res.)

@jongerrish
Copy link
Contributor

Android Studio now supports building resources for tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants