Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution failed for task ':nodejs-mobile-react-native:buildCMakeDebug[x86]' #88

Open
1391735963 opened this issue Jan 12, 2025 · 5 comments

Comments

@1391735963
Copy link

I had this problem, and i use ReactNative 0.76.1,nodejs-mobile-react-native 18.20.4,jdk 21
This is the method I tried

  1. follow the document
  2. read issues https://github.com/nodejs-mobile/nodejs-mobile-react-native/issues/34
  3. read that issues refer code,but the new version include that developers fixed code
  4. clear gradle cache
  5. clear npm cache

next is error message, please help me , i fix this problem 2 weeks ,but have no clue

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':nodejs-mobile-react-native:buildCMakeDebug[x86]'.

com.android.ide.common.process.ProcessException: ninja: Entering directory `C:\wnt-app\node_modules\nodejs-mobile-react-native\android.cxx\Debug\4i3k5t2i\x86'

C++ build system [build] failed while executing:
@echo off
"C:\Users\Lingwl\AppData\Local\Android\Sdk\cmake\3.22.1\bin\ninja.exe" ^
-C ^
"C:\wnt-app\node_modules\nodejs-mobile-react-native\android\.cxx\Debug\4i3k5t2i\x86" ^
nodejs-mobile-react-native-native-lib
from C:\wnt-app\node_modules\nodejs-mobile-react-native\android
ninja: error: '../../../../libnode/bin/x86/libnode.so', needed by '../../../../build/intermediates/cxx/Debug/4i3k5t2i/obj/x86/libnodejs-mobile-react-native-native-lib.so', missing and no known rule to make it

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

BUILD FAILED in 8s

this is my android dictory build.gradle configure
buildscript {
ext {
buildToolsVersion = "35.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.24"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
}
}

apply plugin: "com.facebook.react.rootproject"

@xamp09
Copy link

xamp09 commented Jan 17, 2025

yeah I get this exact error too, something is broken. I am unfamiliar with android and dont know how its toolchain works and interacts with this library or react-native. I will research it and if I find something I will post here

@1391735963
Copy link
Author

i cant fix it , its very hard ,becouse in java or other sourse code has bug,in project first level index.js function start call a import to react-native module NativeModules,NativeModules value is null object,than function start call it,it report error

@olivier-nerot
Copy link

I have the same error here (Mac OS 12, node 22.13.0)
To reproduce it :

npx @react-native-community/cli init
cd myApp
npm install nodejs-mobile-react-native --save
(*)
npm run android

(*) setup steps given here
it returns :

BUILD FAILED in 43s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Note: /Users/admin/Code/MyApp/node_modules/nodejs-mobile-react-native/android/src/main/java/com/janeasystems/rn_nodejs_mobile/RNNodeJsMobileModule.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details. FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':nodejs-mobile-react-native:buildCMakeDebug[x86]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/Users/admin/Code/MyApp/node_modules/nodejs-mobile-react-native/android/.cxx/Debug/194e3n6l/x86' C++ build system [build] failed while executing: /Users/admin/Library/Android/sdk/cmake/3.22.1/bin/ninja \ -C \ /Users/admin/Code/MyApp/node_modules/nodejs-mobile-react-native/android/.cxx/Debug/194e3n6l/x86 \ nodejs-mobile-react-native-native-lib from /Users/admin/Code/MyApp/node_modules/nodejs-mobile-react-native/android ninja: error: '../../../../libnode/bin/x86/libnode.so', needed by '../../../../build/intermediates/cxx/Debug/194e3n6l/obj/x86/libnodejs-mobile-react-native-native-lib.so', missing and no known rule to make it

I've also tried to launch the app with Android Studio (build 21.0.5+-12932927-b750.29 x86_64)

Unhandled SoftException
com.facebook.react.bridge.ReactNoCrashSoftException: raiseSoftException(getOrCreateDestroyTask()): Destroy: ReactInstance task faulted. Stage: 1: Starting destroy. Fault reason: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.. Destroy reason: handleHostException(message = "Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.")
at com.facebook.react.runtime.ReactHostImpl.raiseSoftException(ReactHostImpl.java:1025)
at com.facebook.react.runtime.ReactHostImpl.raiseSoftException(ReactHostImpl.java:1018)
...

A solution or a workaround is welcome.

@olivier-nerot
Copy link

It looks like it the same issue than #78
And the workaround seems to work, by editing /android/gradle.properties :

# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
# ./gradlew <task> -PreactNativeArchitectures=x86_64
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86_64

# Use this property to enable support to the new architecture.
# This will allow you to use TurboModules and the Fabric render in
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false

@1391735963
Copy link
Author

@olivier-nerot thanks,i try it befor report the issue, maybe just my net work problem,i will retry it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants