I've followed this https://reactnative.dev/docs/integration-with-android-fragment to add a RN screen as a Fragment to Android project. There are no errors during compilation. I was getting this error during the build in metro builder, but it was resolved by clearing the app/build folder.
...\node_modules\metro-hermes-compiler\src\emhermesc.js:77
throw ex;
^
Error: EPERM: operation not permitted, lstat '...android\app\build\tmp\kapt3\incrementalData\debug\...'
Emitted 'error' event on NodeWatcher instance at:
at NodeWatcher.<anonymous> (...\node_modules\sane\src\node_watcher.js:291:16)
at callback (...\node_modules\graceful-fs\polyfills.js:299:20)
at FSReqCallback.oncomplete (node:fs:194:21) {
errno: -4048,
code: 'EPERM',
syscall: 'lstat',
path: '...android\\app\\build\\tmp\\kapt3\\incrementalData\\debug\...'
}
Now, while the app runs fine where the native screens are, as soon as RN screens have to load, the app crashes and restarts.
I'm not able to get any error messages, and the metro builder shows no build. Reloading the app from metro builder prints the following warning, although I have the app running through Android Studio.
warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.
One thing I suspect might be responsible is that the Android app doesn't have a default MainActivity file, so I'm getting this with react-native run-android, but not with react-native start
info Starting the app on "emulator-5554"...
Starting: Intent { cmp=com.app.name/.MainActivity }
Error type 3
Error: Activity class {com.app.name/com.app.name.MainActivity} does not exist.
I'm new to the native Android side of things, so please let me know if there's some additional info/ code I can provide.