Facing problems in debug mode while using the latest React Native version (say 0.66 and above)?

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

GraphQL has a role beyond API Query Language- being the backbone of application Integration
background Coditation

Facing problems in debug mode while using the latest React Native version (say 0.66 and above)?

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. 

Facts:

What we tried: 

  • We were using the React Native version above 0.66 (^0.66.3 to be precise) and react-native-animated version was ^2.2.0. 
  • One of our colleagues has an old mac machine (with intel chip) where the above versions worked without troubling him. However, on M1 mac we tried steps like below stated here - https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/
  • Change in android/app/build.gradle 
  • Change in babel.config.js 
  • Change in MainApplication.java
  • This worked if we were not running in debug mode, however, as soon as you turned to debug mode it started throwing errors. 
  • Then, started setting up reanimated 2 by downloading the tgz file from here
  • Select any valid build link (scroll down to end of page)
  • Download .tgz file 
  • Extract it using command “tar zxvf <filename>”
  • Run command “yarn add file:<extracted file name>.tgz>”
  • In our case it was ”yarn add file:react-native-reanimated-2.3.1.tgz”
  • Then just run following command “cd android && gradlew clean” 
  • While compiling it showed us errors like “one file found with OS independent path <lib/armeabi-v7a/libreactnativejni.so> 

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'

    }

  • Please note above so files may change depending on what you’re using also it may not show the error at all. 
  • Again, we were able to run the application without any issues in normal mode, however, as soon as we switched to debug mode, the application started crashing. This time there weren’t any logs or any clue why this was happening. This was the last step we took (in many days) to try and resolve the issue so that we could use the latest React Native version, but unfortunately there wasn’t a way out. 
  • It’s said that chrome debugging support with hermes in 2.3.0-alpha.2 but it didn’t work for us (specifically on M1 machines) 
  • Flipper is another option to be used for debugging instead of Hermes debugger with the latest React Native version, however, we don’t want to integrate a new component all together considering tight timelines, but one can certainly give it a try.  

Solution:

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.

Want to receive update about our upcoming podcast?

Thanks for joining our newsletter.
Oops! Something went wrong.

Latest Articles

Implementing feature flags for controlled rollouts and experimentation in production

Discover how feature flags can revolutionize your software deployment strategy in this comprehensive guide. Learn to implement everything from basic toggles to sophisticated experimentation platforms with practical code examples in Java, JavaScript, and Node.js. The post covers essential implementation patterns, best practices for flag management, and real-world architectures that have helped companies like Spotify reduce deployment risks by 80%. Whether you're looking to enable controlled rollouts, A/B testing, or zero-downtime migrations, this guide provides the technical foundation you need to build robust feature flagging systems.

time
12
 min read

Implementing incremental data processing using Databricks Delta Lake's change data feed

Discover how to implement efficient incremental data processing with Databricks Delta Lake's Change Data Feed. This comprehensive guide walks through enabling CDF, reading change data, and building robust processing pipelines that only handle modified data. Learn advanced patterns for schema evolution, large data volumes, and exactly-once processing, plus real-world applications including real-time analytics dashboards and data quality monitoring. Perfect for data engineers looking to optimize resource usage and processing time.

time
12
 min read

Implementing custom embeddings in LlamaIndex for domain-specific information retrieval

Discover how to dramatically improve search relevance in specialized domains by implementing custom embeddings in LlamaIndex. This comprehensive guide walks through four practical approaches—from fine-tuning existing models to creating knowledge-enhanced embeddings—with real-world code examples. Learn how domain-specific embeddings can boost precision by 30-45% compared to general-purpose models, as demonstrated in a legal tech case study where search precision jumped from 67% to 89%.

time
15
 min read