Reputation: 61
I'm using React Native CLI (version 0.72) and after successfully building the app with
npm run android,
the app opens in the Android emulator but immediately closes without any error messages in the terminal. Here are the key points
The build completes successfully with no errors in the terminal (BUILD SUCCESSFUL).
**
Running on Android Emulator (x86).**
Logcat shows several entries but nothing obvious about why the app crashes. One notable entry:
Unexpected CPU variant for x86: x86_64.
Recreating the emulator.
Clearing Gradle cache.
Invalidating Android Studio caches.
Versions
React Native (0.72)
Android Studio
Android SDK version (SDK 33)
Node.js, npm
My computer is old but in other React Natives CLI project ran android studio ok.
Any ideas on how to resolve this issue or improve emulator compatibility?
✖ Android SDK - Required for building and installing your app on Android
Upvotes: 0
Views: 498
Reputation: 1449
Logcat entry about an "Unexpected CPU variant for x86: x86_64" suggests there might be a compatibility issue between the emulator configuration and your app's build.
You could try the following
Check Emulator Configuration:
React Native and Dependency Versions:
build.gradle
to match one of the existing versions.Clean Build:
cd android
./gradlew clean
cd ..
npm run android
Detailed Logcat Output:
Update Project Dependencies:
Testing on a Physical Device:
Emulator Hardware Profile:
Upvotes: 0