Detox build with a bare react-native project with expo added fails to build

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:

  1. Creating a new project with “npx react-native init detoxexpo --template react-native-template-typescript”.
  2. 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”
  3. 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?

I have gotten Detox working with iOS running on a MacMini. But, have not gotten it working with Android. I actually tried, tried, and tried again before giving up and switching to iOS for Detox. Don’t mean to discourage, but I got the impression Android isn’t as well supported for Detox/Expo.

I have detox working with android (in a bare react native project), it’s just that something is choking when adding expo to the project. iOS is a lot easier to get going though, that’s for sure!