Skip to main content

Android and Gradle Errors in React Native Apps

Android build errors usually come from SDK setup, emulator state, Gradle cache, missing Firebase config, wrong package name, missing debug keystore, or native dependency changes.

Quick Answer

Open Android Studio once to install SDK Platform Tools and create an emulator. Then run:

corepack enable
yarn install
yarn start --reset-cache
yarn android

If Gradle cache is stale:

cd android
./gradlew clean
cd ..
yarn android

Before You Debug Android

Check:

node --version
yarn --version
adb devices

Confirm Android SDK tools are installed in Android Studio:

  • SDK Platform Tools;
  • Android SDK Build-Tools;
  • at least one Android SDK Platform;
  • an emulator image or a connected physical device.

SDK Location Not Found

If Android cannot find the SDK, set ANDROID_HOME in your shell profile:

export ANDROID_HOME="$HOME/Library/Android/sdk"
export PATH="$ANDROID_HOME/platform-tools:$PATH"

Restart the terminal and verify:

adb devices

No Device Or Emulator Detected

Start an emulator from Android Studio Device Manager or connect a physical device with USB debugging enabled.

adb devices

If the device is unauthorized, unlock the device, reconnect the cable, and accept the USB debugging prompt.

Gradle Build Fails

Start with a clean build:

cd android
./gradlew clean
cd ..

Then rebuild:

yarn android

If Gradle points to a specific dependency or plugin, read that error first. Do not change Gradle versions unless the app package or dependency requires it.

Activity Class Does Not Exist

If the terminal says the activity class does not exist but the build succeeded, the app may be installed but not opened automatically.

Try:

  • open the app manually from the emulator;
  • confirm the package name/application ID;
  • uninstall old builds from the emulator;
  • rerun yarn android.

Missing google-services.json

Firebase-backed Android apps need:

android/app/google-services.json

Download it from Firebase Console for the matching Android package name. Then rebuild the app:

yarn android

Package Name Does Not Match Firebase

If Firebase Auth, push, or config behaves incorrectly, confirm the Android package name in Firebase matches applicationId in the Android Gradle config.

After changing the package name:

  1. add a matching Android app in Firebase Console;
  2. download a new google-services.json;
  3. replace the file in android/app;
  4. rebuild Android.

Missing Debug Keystore

If the debug keystore is missing, generate it:

keytool -genkeypair -v \
-storetype PKCS12 \
-keystore android/app/debug.keystore \
-storepass android \
-alias androiddebugkey \
-keypass android \
-keyalg RSA \
-keysize 2048 \
-validity 10000 \
-dname "CN=Android Debug,O=Android,C=US"

Then rerun:

yarn android

Verification

Android is healthy when:

  • adb devices shows a device or emulator;
  • yarn android builds and installs the app;
  • Metro bundles the JavaScript app;
  • Firebase-backed apps include android/app/google-services.json;
  • the app opens after a clean Gradle build.

Next Steps

FAQ

Should I use Android Studio or terminal?

Use Android Studio for SDK Manager, Device Manager, Logcat, and Gradle details. Use the terminal for the normal yarn android workflow.

Should I delete the Android folder?

No. The native Android folder contains app-specific configuration. Use targeted Gradle clean commands instead.