expo icon indicating copy to clipboard operation
expo copied to clipboard

Gradle Build Failed due to Node Process Failure in React Native on Expo - AndroidManifest.xml Fix

Open Ahmadhamdan47 opened this issue 1 year ago • 1 comments

Minimal reproducible example

https://github.com/Ahmadhamdan47/maktoum-aid

What platform(s) does this occur on?

Android

Where did you reproduce the issue?

in a development build

Summary

I encountered an issue while building an Expo project where the Gradle build fails with the error:

:ReactNative:Running '[node, /home/expo/workingdir/build/node_modules/@react-native-community/cli/build/bin.js, config]' command failed. FAILURE: Build failed with an exception.

  • Where: Script '/home/expo/workingdir/build/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 401
  • What went wrong: A problem occurred evaluating script.

Process 'command 'node'' finished with non-zero exit value 1

Environment

expo-env-info 1.2.0 environment info:
    System:
      OS: Windows 10 10.0.19045
    Binaries:
      Node: 18.18.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 3.6.4 - ~\AppData\Roaming\npm\yarn.CMD
      npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD
    SDKs:
      Android SDK:
        API Levels: 31, 34
        Build Tools: 33.0.1, 34.0.0
    IDEs:
      Android Studio: AI-232.10300.40.2321.11668458
    npmPackages:
      expo: ~51.0.28 => 51.0.38
      expo-router: ~3.5.23 => 3.5.23
      react: 18.2.0 => 18.2.0
      react-native: 0.74.5 => 0.74.5
    Expo Workflow: bare

Expo Doctor Diagnostics

✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check native tooling versions
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check for issues with Metro config
✔ Check if the project meets version requirements for submission to app stores
✔ Check for app config fields that may not be synced in a non-CNG project
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that packages match versions required by installed Expo SDK
✔ Check that native modules use compatible support package versions for installed Expo SDK

Ahmadhamdan47 avatar Oct 18 '24 22:10 Ahmadhamdan47

The issue occurs due to a missing package attribute in the AndroidManifest.xml file, which causes the Gradle build to fail with the error: "Process 'command 'node'' finished with non-zero exit value 1." To resolve this, update the AndroidManifest.xml by replacing the line <manifest xmlns:android="http://schemas.android.com/apk/res/android"> with <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="<your package name>">. This change ensures the package attribute is properly set, allowing the build to proceed successfully.

Ahmadhamdan47 avatar Oct 18 '24 22:10 Ahmadhamdan47

hi @Ahmadhamdan47! i'm not sure quite sure what happened in your case as i can't repro this, but the error is actually coming from some react-native-community/cli code and we have completely removed any dependency on react-native-community/cli in sdk 52. https://expo.dev/changelog/2024/10-24-sdk-52-beta

brentvatne avatar Oct 24 '24 23:10 brentvatne