Execution failed for task ':expo-modules-core:buildCMakeDebug[arm64-v8a]'
Asked Answered
T

6

6

I am using react native expo and trying to build project in android studio getting this error

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------

* What went wrong:
Execution failed for task ':expo-modules-core:buildCMakeDebug[arm64-v8a]'.
> Build command failed.
  Error while executing process C:\Users\DELL\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe with arguments {-C E:\My project\React-Native projects\CryptoWallet-DarkMode\expo-crypto-wallet\react-native-vrypto-wallet\node_modules\expo-modules-core\android\.cxx\Debug\6d6s4v4m\arm64-v8a expo-modules-core}
  ninja: Entering directory `E:\My project\React-Native projects\CryptoWallet-DarkMode\expo-crypto-wallet\react-native-vrypto-wallet\node_modules\expo-modules-core\android\.cxx\Debug\6d6s4v4m\arm64-v8a'
  [1/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/Exceptions.cpp.o
  [2/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptRuntime.cpp.o
  [3/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptValue.cpp.o
  [4/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptObject.cpp.o
  [5/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIFunctionBody.cpp.o
  [6/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/CachedReferencesRegistry.cpp.o
  [7/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIInjector.cpp.o
  [8/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/ExpoModulesHostObject.cpp.o
  [9/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JSIInteropModuleRegistry.cpp.o
  [10/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o
  [11/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o
  [12/12] Linking CXX shared library ..\..\..\..\build\intermediates\cxx\Debug\6d6s4v4m\obj\arm64-v8a\libexpo-modules-core.so
  FAILED: ../../../../build/intermediates/cxx/Debug/6d6s4v4m/obj/arm64-v8a/libexpo-modules-core.so 
  cmd.exe /C "cd . && C:\Users\DELL\AppData\Local\Android\Sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --gcc-toolchain=C:/Users/DELL/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/Users/DELL/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libexpo-modules-core.so -o ..\..\..\..\build\intermediates\cxx\Debug\6d6s4v4m\obj\arm64-v8a\libexpo-modules-core.so CMakeFiles/expo-modules-core.dir/src/main/cpp/CachedReferencesRegistry.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/Exceptions.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/ExpoModulesHostObject.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIFunctionBody.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIInjector.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JSIInteropModuleRegistry.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptObject.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptRuntime.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptValue.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o -L"E:/My project/React-Native projects/CryptoWallet-DarkMode/expo-crypto-wallet/react-native-vrypto-wallet/node_modules/expo-modules-core/android/build/react-native-0.69.6-debug.aar/jni/arm64-v8a" -llog  -lfbjni  -ljsi  -lreactnativejni  -lfolly_runtime  -lreact_nativemodule_core  -landroid  -latomic -lm && cd ."
  C:/Users/DELL/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin\ld: cannot open output file ..\..\..\..\build\intermediates\cxx\Debug\6d6s4v4m\obj\arm64-v8a\libexpo-modules-core.so: No such file or directory
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

  


* 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.
==============================================================================


2: Task failed with an exception.
-----------

* What went wrong:
Execution failed for task ':expo-modules-core:buildCMakeDebug[armeabi-v7a]'.
> Build command failed.
  Error while executing process C:\Users\DELL\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe with arguments {-C E:\My project\React-Native projects\CryptoWallet-DarkMode\expo-crypto-wallet\react-native-vrypto-wallet\node_modules\expo-modules-core\android\.cxx\Debug\6d6s4v4m\armeabi-v7a expo-modules-core}
  ninja: Entering directory `E:\My project\React-Native projects\CryptoWallet-DarkMode\expo-crypto-wallet\react-native-vrypto-wallet\node_modules\expo-modules-core\android\.cxx\Debug\6d6s4v4m\armeabi-v7a'
  [1/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/Exceptions.cpp.o
  [2/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptValue.cpp.o
  [3/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptObject.cpp.o
  [4/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIFunctionBody.cpp.o
  [5/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/CachedReferencesRegistry.cpp.o
  [6/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIInjector.cpp.o
  [7/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/ExpoModulesHostObject.cpp.o
  [8/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JSIInteropModuleRegistry.cpp.o
  [9/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptRuntime.cpp.o
  [10/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o
  [11/12] Building CXX object CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o
  [12/12] Linking CXX shared library ..\..\..\..\build\intermediates\cxx\Debug\6d6s4v4m\obj\armeabi-v7a\libexpo-modules-core.so
  FAILED: ../../../../build/intermediates/cxx/Debug/6d6s4v4m/obj/armeabi-v7a/libexpo-modules-core.so 
  cmd.exe /C "cd . && C:\Users\DELL\AppData\Local\Android\Sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi21 --gcc-toolchain=C:/Users/DELL/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/Users/DELL/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security   -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libexpo-modules-core.so -o ..\..\..\..\build\intermediates\cxx\Debug\6d6s4v4m\obj\armeabi-v7a\libexpo-modules-core.so CMakeFiles/expo-modules-core.dir/src/main/cpp/CachedReferencesRegistry.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/Exceptions.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/ExpoModulesHostObject.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIFunctionBody.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JNIInjector.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JSIInteropModuleRegistry.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptModuleObject.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptObject.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptRuntime.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/JavaScriptValue.cpp.o CMakeFiles/expo-modules-core.dir/src/main/cpp/MethodMetadata.cpp.o -L"E:/My project/React-Native projects/CryptoWallet-DarkMode/expo-crypto-wallet/react-native-vrypto-wallet/node_modules/expo-modules-core/android/build/react-native-0.69.6-debug.aar/jni/armeabi-v7a" -llog  -lfbjni  -ljsi  -lreactnativejni  -lfolly_runtime  -lreact_nativemodule_core  -landroid  -latomic -lm && cd ."
  C:/Users/DELL/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: fatal error: ..\..\..\..\build\intermediates\cxx\Debug\6d6s4v4m\obj\armeabi-v7a\libexpo-modules-core.so: open: No such file or directory
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

  


* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 14m 14s
482 actionable tasks: 403 executed, 79 up-to-date

enter image description here

Tufa answered 13/11, 2022 at 11:45 Comment(4)
I also have this issue building locally. However if I build with EAS it works. Although I would prefer to be able to build locally.Neoma
Same exact issue here, I am trying to find a solution but nothing seem working. Have you found a solution? Thank youBung
I am also facing the same issuePlessor
@Neoma same thing if I use Eas Build then it works, but using it takes up my monthly build quota , did you find the solution to this problem ?Welker
C
5

@swatantra-goswami I had the same issue as well! Deleting and re-installing node modules worked for me! Do try the same!

Update

For apple silicon chips, if you get the same error trying to build android, install Rosetta 2 and then try building it. Refer to the below link for the command to install.

The expo-av:configureCMakeDebug task uses the CMake version 3.18.1. For some reason, this version is not made for arm64 (m1 silicon), so I had to install de Rosetta 2.

Rosetta 2 enables a Mac with Apple silicon to use apps built for a Mac with an Intel processor.

To install Rosetta just run:

/usr/sbin/softwareupdate --install-rosetta

Close all terminal windows and re-run your command, in my case, yarn android

Refer this GitHub issue link

Chalaza answered 23/11, 2022 at 3:27 Comment(1)
Also have to delete package-lock.json as the issue is triggered by package versionsMaund
Z
1

i found it's really weird but what really worked for me was these steps:

  • move project folder to shorter path (i move from very long path to just C://)
  • completely delete android folder
  • using npm i to reinstall
  • using npx expo-doctor
  • updating/upgrading whichever package said not compatible / warning by npx expo-doctor.

Let me know if this helps!

Zamir answered 28/2 at 0:58 Comment(1)
just the just step worked for me it, did not needed the others, thanksWelker
D
1

I was facing the same error. I checked android studio and I had two versions of CMake and latest version of ndk. I downgraded ndk to 26.1.10909125 and only kept 3.22.1 version of CMake.It worked for me. Hope it helps.

Dysthymia answered 7/10 at 16:5 Comment(0)
W
0

I have faced the same issue, however after reinitializing react-native app with npx [email protected] init it worked properly with [email protected].

I have used bare react-native (version 0.70.6) initialization. So, in order to add expo to an existing project see https://docs.expo.dev/bare/installing-expo-modules/

Have you checked these directories where expo-modules-core.so must be? build\intermediates\cxx\Debug\6d6s4v4m\obj\armeabi-v7a build\intermediates\cxx\Debug\6d6s4v4m\obj\armeabi-v8a

If expo-modules-core.so files exist in these folders and you use windows, then you probably have problem with win32 long paths. See https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry

In order to enable long paths, you need to enable them on system (see link above) and attach executable manifest to ld executable (see How do I add a manifest to an executable using mt.exe?) which throws an error. In your case, you can see path to the ld executable in error log.

For manifest file I have used this configuration from https://github.com/ninja-build/ninja/blob/master/windows/ninja.manifest :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
  <application>
    <windowsSettings>
      <activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
      <longPathAware  xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
    </windowsSettings>
  </application>
</assembly>
Wills answered 16/1, 2023 at 11:35 Comment(0)
B
0
  1. Make sure right build variant selected.
  2. Check your supported JavaVersion in Android Studio: Project Setting> Build> BuildTools> Gradle.
Bangup answered 30/1 at 7:32 Comment(0)
R
0

after some time searching for a solution, as deleting the node modules and cleaning the gradlew didn't work, I noticed that the issue could be related to the project path. Since the project was located in many subfolders, it ended up crashing at this point. I moved it to a folder directly on the C: drive and without any special characters in the folder names, and it worked.

Ruttish answered 22/2 at 19:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.