Mobile Development – Common Errors & Fixes

When developing mobile applications for Android or iOS, encountering build errors is a regular part of the process. These errors can stem from SDK misconfigurations, dependency issues, or quirks in cross-platform libraries like React Native. Below is a list of common issues developers face, along with tested solutions.

1. Broken or Missing Build Tools (Android)

Error:

Build-tool 35.0.0 is missing AAPT at /.../build-tools/35.0.0/aapt

FAILURE: Build failed with an exception.
> Installed Build Tools revision 35.0.0 is corrupted. Remove and install again using the SDK Manager.

Symptoms:

  • Gradle build fails almost immediately.

  • Compilation of Java sources (:app:compileDebugJavaWithJavac) cannot proceed.

  • Error points to a corrupted or incomplete installation of Build Tools.

Solution:

  1. Open Android Studio.

  2. Go to SDK Manager → SDK Tools.

  3. Uncheck and re-check Android SDK Build-Tools 35.0.0, then click Apply to reinstall.

  4. Alternatively, run:

    sdkmanager --uninstall "build-tools;35.0.0"
    sdkmanager "build-tools;35.0.0"

2. expo run:android Fails – Emulator Not Detected

Error:

Likely Cause:

  • The Android Debug Bridge (ADB) cannot find a running emulator.

  • Emulator may not be initialized or started properly.

Solution:

  1. Start Android Studio.

  2. Go to Tools → Device Manager, then launch a virtual device.

  3. Verify the emulator is listed using:

    You should see a list like:

Note: If no devices are listed, try restarting ADB:

3. Path Handling Errors in react-native-libsodium (Windows)

Error Symptoms:

  • Build fails due to invalid escape sequences (\A, \b, etc.).

  • Common when project paths include backslashes (e.g., D:\Application\...).

Root Cause: CMake interprets \\ in Windows-style paths as escape sequences. This causes malformed paths when building native dependencies.

Solution: Manually modify the CMakeLists.txt file in the react-native-libsodium dependency:

File Path:

Fix: Add the following lines to convert NODE_MODULES_DIR into a valid CMake path:

Then replace references to NODE_MODULES_DIR with SAFE_NODE_MODULES_DIR. For example:

After saving the file: Clean and rebuild your Android project:

Recommended Tip: Avoid placing your project in folders with capital letters or special characters (e.g., D:\Application\Xion) to reduce CMake path issues.

4. ADB Shows Duplicate or Ghost Devices

Symptoms:

  • Android Studio’s AVD only lists one emulator, but adb devices shows multiple.

  • Build errors or confusion about which emulator is active.

Cause:

  • Stale ADB device entries from previously deleted or corrupted emulator instances.

Fix: Restart the ADB server:

If this doesn't resolve it:

  • Delete all unused emulators from Android Studio → Device Manager.

  • Recreate new AVDs to avoid misconfigured devices.

Extra Tips for Smooth Builds

  • Always use Node.js LTS versions for React Native projects (avoid experimental versions like v23).

  • Run npx expo doctor or npx react-native doctor regularly to diagnose config issues.

  • Keep your Expo CLI and dependencies up to date:

Still Stuck?

If you continue to encounter issues:

  • Run the command with --verbose or --stacktrace to get detailed logs.

Last updated

Was this helpful?