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
Supporting CollapsingToolbarLayout #2580
Comments
Caused by: android.content.res.Resources$NotFoundException: Unable to find Robolectric can't find this resource, can you figure out which one it is. What build system are you using ? On Jul 22, 2016 7:53 AM, "Miquel Beltran" notifications@github.com wrote:
|
The ID number is not present in the R files. I think this resource is not mine but from the Support Library? The NotFoundException has this trace in it.
Seems that it cannot find this defined CollapsedTextAppearance. I am not setting such attribute in the layout or code.
I am using Android Studio 2.1.2 on Mac OS. |
I fixed the issue by creating my own Shadow for the CollapsingToolbarLayout. https://gist.github.com/miquelbeltran/65c8f5327d71e6f1074180e0c18c7f53 Feel free to close the issue and/or use the provided Shadow to implement a proper solution. |
+1 i have the same issue with roboelectric. Targeting API 24 (22 in the config for roboelectric test) running in Android Studio 2.2 preview 7. I have heirarchy the same as @miquelbeltran in most of the fragments I'm looking to test, so this definitely poses an issue. I'll check out implementing the shadow above and check back. |
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. |
Description
I want to test a Fragment that contains a CollapsingToolbarLayout with Robolectric but I am facing the current issue when running startFragment.
android.view.InflateException: XML file build/intermediates/res/merged/dev/layout/fragment_homefeed.xml line #-1 (sorry, not yet implemented): XML file build/intermediates/res/merged/dev/layout-v21/layout_homefeed_header.xml line #-1 (sorry, not yet implemented): Error inflating class android.support.design.widget.CollapsingToolbarLayout
Full stack trace
Is there any way I can support CollapsingToolbarLayout with Robolectric?
I couldn't find a solution, neither on GitHub or StackOverflow.
Steps to Reproduce
The CollapsingToolbarLayout attributes:
Robolectric & Android Version
Extract from my build.gradle
The text was updated successfully, but these errors were encountered: