I believe that's a question for the Robolectric devs. Our current unit testing solution considers resource lookups a platform feature that we don't emulate on the JVM at all. If it turns out there are changes needed on our end to make it work, I will be happy to make them.
Michal On Monday, July 13, 2015 at 11:23:10 PM UTC+1, Colin Madere wrote: > > I'm using the latest gradle android plugin (v1.2.3) and followed some of > the latest posts about how to make normal JUnit testing (with Robolectric) > work without hacks ( > https://www.bignerdranch.com/blog/triumph-android-studio-1-2-sneaks-in-full-testing-support/). > > I had success on my project which does NOT modify (uses the single default > value for) `sourceSets.main.java.srcDirs`. However, my second project > needs to include some generated code and so I added a block like this: > > sourceSets { > main { > java.srcDirs = ['src/main/java', 'src/main/java-gen'] > } > } > > > Doing this seems to cause the Robolectric/Junit tests to fail with > "android.content.res.Resources$NotFoundException" on any resource request. > This worked with my previous hack that was copying all kinds of things > around, but it seems odd that adding an additional src dir (that doesn't > have to do with resources) would cause an error in finding resources. > Tried looking for a bug for this but didn't have luck (just other > unrelated "can't find resources" bugs that all have workarounds involving > copying resources, such as: > https://code.google.com/p/android/issues/detail?id=64887#c13). > > Wanted to see if the list had any input/knowledge on this particular > problem (or if a bug report already exists that I haven't found). > > Thanks, > Colin > > -- You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
