We are using React Native for more than 2 years now, however, recently (mainly on M1 machines) we are facing problems in debug mode when using the latest React Native versions (say 0.66 and above) With these latest RN versions
We are using React Native for more than 2 years now, however, recently (mainly on M1 machines) we are facing problems in debug mode when using latest React Native versions (say 0.66 and above) With these latest RN versions we are using latest version of react-navigation/drawer as well which internally uses react-native-reanimated. This reanimated library is majorly causing trouble in debug mode.
To resolve above issue added below block of snippet in apps’ build.gradle file
packagingOptions {
pickFirst 'lib/armeabi-v7a/libreactnativejni.so'
pickFirst 'lib/x86_64/libreactnativejni.so'
pickFirst 'lib/x86/libreactnativejni.so'
pickFirst 'lib/arm64-v8a/libreactnativejni.so'
pickFirst 'lib/armeabi-v7a/libfolly_json.so'
pickFirst 'lib/x86_64/libfolly_json.so'
pickFirst 'lib/x86/libfolly_json.so'
pickFirst 'lib/arm64-v8a/libfolly_json.so'
pickFirst 'lib/armeabi-v7a/libglog.so'
pickFirst 'lib/x86_64/libglog.so'
pickFirst 'lib/x86/libglog.so'
pickFirst 'lib/arm64-v8a/libglog.so'
pickFirst 'lib/armeabi-v7a/libjscexecutor.so'
pickFirst 'lib/x86_64/libjscexecutor.so'
pickFirst 'lib/x86/libjscexecutor.so'
pickFirst 'lib/arm64-v8a/libjscexecutor.so'
pickFirst 'lib/armeabi-v7a/libhermes.so'
pickFirst 'lib/x86_64/libhermes.so'
pickFirst 'lib/x86/libhermes.so'
pickFirst 'lib/arm64-v8a/libhermes.so'
}
And thus here was our solution which worked on M1 machine which was nothing else than to downgrade the existing React Native version to:
"react-native": "0.62.0",
"react-native-reanimated": "2.2.0"
“react”: “17.0.1”
Please make sure you’re also running
“react-native link” command, libraries are saying that they support auto-linking but not all are and that solved the issue for us.
Few of other important points are:
1. If you encounter duplicate resources issue run command -
rm -rf android/app/src/main/res/raw*
rm -rf android/app/src/main/res/drawable*
2. If you encounter "unknown: ReactNative: Exception in native call"
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
This works well in all modes and we could now debug the issues. I hope you will find the post insightful and if there’s any update you want us to provide please don’t hesitate to contact or please comment below.