-
Notifications
You must be signed in to change notification settings - Fork 177
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
SoLoader causes instrumented tests to crash #94
Comments
same here. any update? |
@henryzx I found a workaround that lets me run my tests: https://stackoverflow.com/questions/21367646/how-to-determine-if-android-application-is-started-with-junit-testing-instrument?noredirect=1&lq=1 |
Co-experiencing this issue. @CiaraSouthgateFT are you able to clarify how that solution you posted helps? |
@RowlandOti I believe what @CiaraSouthgateFT was saying is that they conditionally don't use SoLoader if they're within an instrumentation test. For example, if you create a file under your package com.example
object TestMarker Then you can detect if you're running in a test (in your private val isTest: Boolean
get() = try {
Class.forName("com.example.TestMarker")
true
} catch (e: ClassNotFoundException) {
false
} Then, where you normally use SoLoader: if (!isTest) SoLoader.init(context, false) ...it doesn't "fix" the issue, but does allow instrumentation tests to run (where SoLoader and tools like Flipper, are not needed). Hope that helps. |
Hi, I encountered the same issue while running Detox (instrumented tests) on a React Native 0.68 project with Hermes enabled. AndroidJUnitRunner would instantly crash at startup.
I was able to solve it by downgrading SoLoader to v0.9.0+ using resolutionStrategy. Any idea why this is happening? EDIT: Looks like something broke in v0.10.2 |
I also ran into the same problem as @ericschaal and your research helped me get our Android Detox tests running again. Thanks very much. |
In turn, I was mentioned in that linked wix/Detox issue and was curious what was going on here. It appears that there has been a mountain of work in this repo since the last release, all directly affecting the code paths in question, so examining the diff between 0.10.1 (working) and 0.10.2 (not working) isn't that fruitful since "current stable" is so different. Begs the question: is it possible to get a new release from current repo state (even if just attached) and some guidance on how to integrate it via gradle so testing + a reproduction repo is productive? |
Stumble upon the same issue when updating the flipper to latest(0.149.0) version. After digging it I noticed that flipper updates its soLoader dependency on v0.119.0 from 0.10.1 to 0.10.3. I verified flipper v0.118.1 works without any issue but v0.119.0 crashes all instrumented tests to fail. I disabled flipper for the tests but we also use yogalayout and have to load soLoader and due to this transitive dependency tests were still failing. I fix the problem by enforcing soLoader to v0.10.1.
|
Issue seems to be gone for us after updating the SoLoader dependency to 10.0.4: |
Yes, I can see a commit that explains why this happens as well as the applied fix: 9008446 |
So it seems soloader 0.10.4 fixes it I'm posting this info for react-native here for release planning purposes reactwg/react-native-releases#26 (comment) (just merged on react-native main, should hopefully be in react-native 0.70.0 when released) |
soloader 0.10.3 will apparently cause crashes in instrumented tests, 0.10.4 appears to fix these crashes Related: facebook/SoLoader#94 Related: reactwg/react-native-releases#26 (comment)
Summary: soloader 0.10.3 will apparently cause crashes in instrumented tests, 0.10.4 appears to fix these crashes Related: facebook/SoLoader#94 Related: reactwg/react-native-releases#26 (comment) ## Changelog [Android] [Changed] - Bump Soloader to 0.10.4 Pull Request resolved: #34213 Test Plan: This is hard to test since it's in the AAR etc., I'm hoping CI is sufficient as the previous soloader bump PR went through similarly Reviewed By: cipolleschi Differential Revision: D37960320 Pulled By: cortinico fbshipit-source-id: ce1611d7b30df737c8525a70839b5491a6585c75
All these answers helped me. Thank you all |
Summary: soloader 0.10.3 will apparently cause crashes in instrumented tests, 0.10.4 appears to fix these crashes Related: facebook/SoLoader#94 Related: reactwg/react-native-releases#26 (comment) ## Changelog [Android] [Changed] - Bump Soloader to 0.10.4 Pull Request resolved: #34213 Test Plan: This is hard to test since it's in the AAR etc., I'm hoping CI is sufficient as the previous soloader bump PR went through similarly Reviewed By: cipolleschi Differential Revision: D37960320 Pulled By: cortinico fbshipit-source-id: ce1611d7b30df737c8525a70839b5491a6585c75
Upgrading from i already added this is my log
|
Hi @ko-devHong, can you share the crashy apk? |
This issue should be addressed in |
Bug Report
SoLoader looks for libfbjni in the .test path during instrumented tests. I am not sure how it makes that decision, since package name still reports without .test.
Since the tests use a debug variant, I don't see a way to prevent Flipper loading during instrumented tests.
To Reproduce
Run an instrumented test
Environment
Android API 31
debugImplementation 'com.facebook.flipper:flipper:0.137.0'
debugImplementation 'com.facebook.soloader:soloader:0.10.3'
releaseImplementation 'com.facebook.flipper:flipper-noop:0.137.0'
The text was updated successfully, but these errors were encountered: