-
Notifications
You must be signed in to change notification settings - Fork 59
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
UI Testing Robolectric Issue #73
Comments
Thanks for submitting this issue and a workaround! |
I didn't look into the details too much, other than "bytecode instrumentation magic". |
When running Robolectric tests we would get the following error: `java.lang.IllegalAccessError: tried to access class kotlin.jvm.internal.DefaultConstructorMarker from class androidx.appcompat.widget.MaterialRecyclerViewPopupWindow$Companion`. Additional changes: - changed visibility of some internal classes i.e. `MaterialRecyclerViewPopupWindow` & `SectionedRecyclerViewAdapter` as they were not meant to be exposed anyway - update Gradle & AGP versions - target API version 28 -> 29 - moved `SanityTest` to `sharedTest` source set so that it can be tested with Robolectric as well
When running Robolectric tests we would get the following error: `java.lang.IllegalAccessError: tried to access class kotlin.jvm.internal.DefaultConstructorMarker from class androidx.appcompat.widget.MaterialRecyclerViewPopupWindow$Companion`. Additional changes: - changed visibility of some internal classes i.e. `MaterialRecyclerViewPopupWindow` & `SectionedRecyclerViewAdapter` as they were not meant to be exposed anyway - update Gradle & AGP versions - target API version 28 -> 29 - moved `SanityTest` to `sharedTest` source set so that it can be tested with Robolectric as well
Hi @JamesRoome, |
Yes is works, happy to delete my CustomRobolectricTestRunner! Thanks for the quick fix. |
Error
When trying to do automated UI tests with Robolectric I get this error:
java.lang.IllegalAccessError: tried to access class kotlin.jvm.internal.DefaultConstructorMarker from class androidx.appcompat.widget.MaterialRecyclerViewPopupWindow$Companion
This is caused by
MaterialRecyclerViewPopupWindow
being in theandroidx
namespace so Robolectric does its bytecode magic on it.Fix:
Don't put MaterialRecyclerViewPopupWindow in the androidx namespace.
Workaround:
Use a custom RobolectricTestRunner
The text was updated successfully, but these errors were encountered: