App Fails to Open in Espresso, "java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so"
When using Espresso, the tests fail with " Request failed with status 500 due to session not created: A new session could not be created. Details: Espresso server process has been unexpectedly terminated". The ADB stack trace shows the app fails to launch because of "java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so" Below is my configuration...
capabilities: [{
platformName: 'Android',
platformVersion: '11',
deviceName: 'Pixel_3a_API_30',
appPackage: 'com.awesomeproject',
appActivity: 'com.awesomeproject.MainActivity',
app: './../android/app/build/outputs/apk/debug/app-debug.apk',
automationName: 'Espresso',
showGradleLog: true,
espressoBuildConfig: "{ \"gradle\": \"7.1.1\", \"toolsVersions\": { \"kotlin\": \"1.6.10\", \"buildTools\": \"31.0.0\", \"compileSdk\": \"31\", \"minSdk\": \"26\", \"targetSdk\": \"31\" }, \"additionalAppDependencies\": [ \"androidx.lifecycle:lifecycle-runtime-ktx:2.5.1\", \"androidx.lifecycle:lifecycle-livedata-ktx:2.5.1\" ] }",
forceEspressoRebuild: true
}]
This is literally a stock React Native app just initialized with the CLI with no other modifications. It is frustrating that setting this up in such a clean state is so difficult. The same tests run 100% fine using UIAutomator2. I assume I am doing something super silly and wrong, but I haven't been able to figure it out yet.
Any help would be much appreciated.
Espresso and UIA2 have different architectures at Android OS level. Espresso generally depends on the app under test,
https://developer.android.com/training/testing/espresso , so as you already use espressoBuildConfig, probably something react native specific dependencies are needed to the espresso server.
I haven't heavily used RN, but the error message looks like something RN specific one...? https://stackoverflow.com/questions/57036317/react-native-java-lang-unsatisfiedlinkerror-couldnt-find-dso-to-load-libherm