When working with Expo and React Native, it’s not uncommon to encounter situations where your app runs flawlessly in Expo Go, but crashes in a standalone APK. This guide provides a clear, general-purpose methodology to systematically diagnose and resolve such issues to ensure a smooth production rollout.
1. Understanding the Problem
Expo Go vs. Standalone APK
Expo Go includes a large set of precompiled native modules and uses consistent, tested versions internally. Standalone APKs, however, bundle only the specific native modules you configure. As a result, version mismatches or missing configurations may surface only after building an APK.
2. Reproducing and Capturing the CrashStep 1: Build and Install the APK
Use Expo CLI or EAS Build to generate the APK. Install it on a real device or emulator.
Step 2: Set Up Android Debugging
Install Android Platform Tools:
brew install --cask android-platform-tools
Or download from Android Developer Tools.
Step 3: Enable USB Debugging
Enable Developer Options and USB Debugging on your Android device.
Step 4: Monitor Logs via ADB
Connect the device and run:
adb logcat
Or filter logs for your app package:
adb logcat | grep yourpackagename
Step 5: Reproduce the Crash
Open the installed APK and interact with it until it crashes. Look for log lines including FATAL EXCEPTION or errors like NoSuchMethodError.
3. Analyzing the Crash Log
A typical crash:
java.lang.NoSuchMethodError: No virtual method getConverterProvider()...
This suggests a version mismatch between your JavaScript libraries and native code included in the APK. It usually points to an outdated or incompatible version of a core Expo or Kotlin module.
4. Diagnosing Dependency MismatchesStep 1: Check Project Health
Run:
npx expo doctor
This scans for version mismatches across your dependencies.
Step 2: Sync Dependencies to SDK
Run:
npx expo install
This installs the correct versions of Expo packages based on your SDK version.
Step 3: Manually Align Key Packages
For anything not automatically updated (e.g. expo-router, react-native):
npm install expo-router@<expected-version> react-native@<expected-version>
Refer to the Expo SDK release notes for supported versions.
Step 4: Clean Install
Remove old dependencies and reinstall:
rm -rf node_modules package-lock.json yarn.lock npm install # or yarn install
Step 5: Clear Build Cache
npx expo start -c
This clears cached JavaScript and assets.
5. Rebuilding and Testing
After fixing dependency versions:
If the issue was due to a native module mismatch, the crash should now be resolved.
6. Key Takeaways and Best Practices
7. Common Pitfalls to Avoid
Conclusion
APK crashes in Expo projects often stem from subtle mismatches in native module versions. By methodically capturing the crash, checking logs, syncing dependencies, and rebuilding your project, you can eliminate these issues and ship stable standalone builds confidently.
Pro Tip:
Add dependency health checks (expo doctor) in your CI pipeline to catch version mismatches early.
This structured debugging process can be reused across any Expo-based app to identify and fix production-breaking issues quickly.