I was trying to run my ReactNative
application on the Android Studio emulator – pixel . But , it’s not working and gives the following error instead .
ERROR Error: Exception in HostObject::get for prop
‘NativeUnimoduleProxy’: java.lang.SecurityException: Permission
Denial: registerScreenCaptureObserver from pid=9773, 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 was trying to run my app on the android studio emulator . It worked perfectly fine when run in VSCode and viewed in an external mobile device instead of using the android studio emulator .
2
Answers
For me I was struggling with this for days, and then I just updated the Android API SDK to the latest version through Android Studio, and the problem was solved.
If you see
update available
instead ofinstalled
just uncheck and re-check again and hit applyFor me, the solution was to delete the previous emulator i had, using the "VanillaIceCream", delete the SDK, and them install a new simulator with api 34 ("UpSideDownCake").
The error went away after this.