I’ve just created an Expo Project with the following command:
npx create-expo-app@latest --template tabs@50
I have everything I need installed (I think?): Android Studio, Xcode, etc.
When running npm start android, the emulator opens and then crashes with this error:
ERROR Error: Exception in HostObject::get for prop 'NativeUnimoduleProxy': java.lang.SecurityException: Permission Denial: registerScreenCaptureObserver from pid=2093, uid=10182 requires android.permission.DETECT_SCREEN_CAPTURE, js engine: hermes
ERROR Error: Exception in HostObject::get for prop 'NativeUnimoduleProxy': java.lang.SecurityException: Permission Denial: registerScreenCaptureObserver from pid=2093, uid=10182 requires android.permission.DETECT_SCREEN_CAPTURE, js engine: hermes
ERROR Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes
I have not modified anything in the project. What does this error mean?
I tried just creating the project with the template (from expo docs).
Expected the app to open in Android Emulator, but it crashes.
2
Answers
I managed to get this working after a few steps. I’m not sure if these are all necessary, and I’m not sure if this includes everything I did since I tried many things before getting it to work, but hopefully this at least helps.
app.json
file.yarn expo upgrade
sudo xcode-select --switch /Applications/Xcode.app
PATH
variable (i.e.: update your~/.bashrc
or~/.zshrc
file).yarn expo prebuild
yarn android
If you´re experiencing this error with
expo go
, your emulator Android System Image is probably "too new". For me "VanillaIceCream" API level wasn’t working. Others reported on the expo discord, that "UpsideDownCakePrivacySandbox" wasn’t working either. I took "UpsideDownCake" / API Level 34 which worked for me. According to official expo docs "Tiramisu" also works. I did not try "TiramisuPrivacySandbox".Here is a screenshot of Android Studio Device Manager