I have a project that is react-native based and has expo added to use a few expo-based packages. When building a detox test for android, the build always fails with the error “FAILED: CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptRuntime.cpp.o” and “…/…/…/…/src/main/cpp/JavaScriptRuntime.cpp:12:10: fatal error: ‘hermes/hermes.h’ file not found
#include <hermes/hermes.h>”.
I have created a minimum viable repro to show the problem, GitHub - gorbypark/detoxexpo
This github repo has three commit:
- Creating a new project with “npx react-native init detoxexpo --template react-native-template-typescript”.
- Adding and configuring detox as per the android installation docs. At this point the test builds fine and works as expected, “npx detox build --configration android.emu.debug”
- Adding expo with “npx install-expo-modules@latest”.
After adding expo, “npx detox build --configration android.emu.debug” fails with the above errors.
I do not have a lot of experience with the android build system or Java/Kotlin, but here is my theory. “npx install-expo-modules@latest” touches a number of things, but mainly seem to be wrapping a few of the “entry” functions in MainApplication.java and MainActivity.java, with function calls such as “ReactActivityDelegateWrapper” imported from expo, for example. When configuring detox, a android/app/src/androidTest/java/com/DetoxTest.java test is created where detox injects what it needs to into the app to be able to control it. I think that the DetoxTest.java requires some of these expo “wrapper functions” in order to correctly initiate itself.
I may be a long way off, but I’m grasping at straws here. Anyone have any ideas?