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
InflateException while inflating layout with android.support.v7.app.MediaRouteButton #2991
Comments
+1 |
1 similar comment
+1 |
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. |
Hi @jongerrish trying to verify with my sample app (https://github.com/mykwillis/android-mediaroutebutton-test), but get a gradle error when changing robolectric version to 4.0. Is this a known issue?
|
Ah right, yeah, we're aware of this issue and working to address it:
#4066
|
@mykwillis — make sure you're using the latest Android Gradle Plugin. |
Thanks @xian upgrading the Gradle Plugin made it past that step.
When I add:
to build.gradle. (Using com.android.tools.build:gradle:3.2.1) https://github.com/mykwillis/android-mediaroutebutton-test/blob/master/app/build.gradle |
Sorry my bad that property goes in your gradle.properties
…On Thu, Nov 1, 2018, 10:17 AM mykwillis ***@***.*** wrote:
Thanks @xian <https://github.com/xian> upgrading the Gradle Plugin made
it past that step.
Now I have to figure out why I'm getting:
Could not set unknown property 'enableUnitTestBinaryResources' for object
of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
When I add:
android {
// ...
//enableUnitTestBinaryResources=true // "Could not set unknown property 'enableUnitTestBinaryResources' for object of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
testOptions {
unitTests {
includeAndroidResources = true
}
}
//...
}
to build.gradle. (Using com.android.tools.build:gradle:3.2.1)
https://github.com/mykwillis/android-mediaroutebutton-test/blob/master/app/build.gradle
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2991 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGBaeIg-7zGuFchrcGcQS5VO9UBLs9Mwks5uqyybgaJpZM4MldCf>
.
|
ok got it! Sorry for all the back-and-forth. I can now confirm that the original problem reported in this ticket is fixed with robolectric 4.0 when using the directives you describe above. Example project has been updated at: https://github.com/mykwillis/android-mediaroutebutton-test |
Huzzah! |
Description
When a layout (xml) file contains an android.support.v7.app.MediaRouteButton, Robolectric will throw an InflateException when trying to inflate the view with the following error message:
It appears the wrapped Exception is probably closer to the root problem:
Steps to Reproduce
Create an Android Studio project with an empty MainActivity.
Add an <android.support.v7.app.MediaRouteButton> element (fromcom.android.support:mediarouter-v7:25.3.0) to the layout.xml.
Create a Robolectric test case that attempts to load the MainActivity.
I have a minimal sample project that exhibits the problem on Github here
Robolectric & Android Version
I am using the latest Robolectric (3.3.1) and the most recent Android development tools.
From my project build.gradle:
The text was updated successfully, but these errors were encountered: