The new Android Studio Build cache no longer creates exploded-aars. The solution to get resources for tests from: https://github.com/robolectric/robolectric/issues/1334 will not work with the build cache enabled (now enabled by default in Android Studio 2.3.
A solution is to disable the build cache but obviously this is not an ideal solution.
Robolectric 3.0
Android Studio 2.3
Gradle Plugin 2.3.0
Gradle 3.3
In the 2.4-previews of the Android Gradle Plugin, in addition to the workaround of disabling the build cache, one must also disable the new dependency resolution mechanism in gradle.properties.
android.enableImprovedDependenciesResolution=false
Otherwise, resources/assets by external module dependencies will not be found.
Able to see similar issue for this configuration:
roboelectric - 3.0
gradle - 3.3
Android Studio - 2.3.3
We have project.properties file pointing to library placed in exploded-aar folder which is not generated once we switch to android gradle plugin 2.3.3
Am I right that latest roboelectric (3.3.2) still has the same issue?
Same issue here :(
Using latest AS canary + latest Robolectric
Could not find any resource from reference ResName{com.example.app:style/Theme_AppCompat_Light_DarkActionBar} from Style com.example.app:AppTheme with theme with no applied styles
I have the exact same issue as @vpratrf using:
AS: 3 canary 7
Robolectric: 3.4-SNAPSHOT
Android build plugin: 3.0.0-alpha7'
Disabling android build-cache by adding:
android.enableBuildCache=false
to my build.gradle file doesn't fix the issue. exploded-aar folder isn't created and I get
Could not find any resource from reference ResName{com.example.app:style/Theme_AppCompat_Light_DarkActionBar} from Style com.example.app:AppTheme with theme with no applied styles
We've revamped resources in Robolectric 4.0 to process the binary resource files + arsc table produced by aapt and the resource handling code is now much closer to that of the framework. This includes changes to parse the merged manifest using the Android platform code.
Mind giving this a try with 4.0 + binary resources by configuring your gradle.build as follows:-
testImplementation "org.robolectric:robolectric:4.0"
android {
enableUnitTestBinaryResources=true
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
We're doing a big bug scrub and trying to be aggressive about it so apologies if this was closed in error, in which case feel free to reopen.
If this is still an issue an example project with failing test would be most helpful.
Most helpful comment
I have the exact same issue as @vpratrf using:
AS: 3 canary 7
Robolectric: 3.4-SNAPSHOT
Android build plugin: 3.0.0-alpha7'
Disabling android build-cache by adding:
android.enableBuildCache=falseto my build.gradle file doesn't fix the issue. exploded-aar folder isn't created and I get