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

[0.76.2] windows android build fails #47626

Closed
lovegaoshi opened this issue Nov 15, 2024 · 10 comments
Closed

[0.76.2] windows android build fails #47626

lovegaoshi opened this issue Nov 15, 2024 · 10 comments
Labels
0.76 Needs: Author Feedback Needs: React Native Team Attention Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications.

Comments

@lovegaoshi
Copy link

lovegaoshi commented Nov 15, 2024

Description

windows android build on 0.76.2 fails due to an invalid escape character error during cmake. this is probably bc 3956955 introduced REACT_ANDROID_DIR for cmake, but not escaping \ to / like BUILD_DIR did.

I just added REACT_ANDROID_DIR \ escaping under the CMAKE_HOST_WIN32 if above and it works again. like

if(CMAKE_HOST_WIN32)
        string(REPLACE "\\" "/" BUILD_DIR ${BUILD_DIR})
        string(REPLACE "\\" "/" REACT_ANDROID_DIR ${REACT_ANDROID_DIR})

Steps to reproduce

build 0.76.2 on windows

React Native Version

0.76.2

Affected Platforms

Build - Windows

Output of npx react-native info

n/a

Stacktrace or Logs

n/a

Reproducer

n/a

Screenshots and Videos

No response

@react-native-bot react-native-bot added Platform: Android Android applications. Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Nov 15, 2024
@react-native-bot
Copy link
Collaborator

Warning

Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

@boiboif
Copy link

boiboif commented Nov 15, 2024

Same issue after upgrade to 0.76.2

@migueldaipre
Copy link
Collaborator

Hey @lovegaoshi, thanks for reporting this issue.

Would you like to open the PR with the fix?

@aelassas
Copy link

Same issue with react-native 0.76.2.

@salmanhassankistpay
Copy link

Same Issue after 0.76.1 to 0.76.2

info Installing the app...

> Task :app:configureCMakeDebug[arm64-v8a] FAILED
C/C++: CMake Error at C:/Users/Salman/Desktop/personal/MyApp/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:42 (add_library):
C/C++: Syntax error in cmake code when parsing string
C/C++: C:\Users\Salman\Desktop\personal\MyApp\node_modules\react-native\ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp
C/C++: Invalid character escape '\U'.
C/C++: Call Stack (most recent call first):
C/C++: CMakeLists.txt:31 (include)
36 actionable tasks: 26 executed, 10 up-to-date

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:configureCMakeDebug[arm64-v8a]'.

[CXX1429] error when building with cmake using C:\Users\Salman\Desktop\personal\MyApp\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt: -- The C compiler identification is Clang 17.0.2
-- The CXX compiler identification is Clang 17.0.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Users/Salman/AppData/Local/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler:

when newArchEnabled=false then build is running and working fine while enabling this to true it gives error .

@salmanhassankistpay
Copy link

salmanhassankistpay commented Nov 16, 2024

Solved by adding this line

string(REPLACE "\" "/" REACT_ANDROID_DIR ${REACT_ANDROID_DIR}) on line number 36

\node_modules\react-native\ReactAndroid\cmake-utils\ReactNative-application.cmake

WhatsApp Image 2024-11-16 at 17 53 17_877e45d4

@yadhukrishnasm
Copy link

Check by uninstalling and installing node modules, and i changed the react-native version to 18.3.1
it seems like 18.3.2 has this issue

@javache
Copy link
Member

javache commented Nov 18, 2024

Resolved by #47641

@javache javache closed this as completed Nov 18, 2024
@Rehana001
Copy link

Description

windows android build on 0.76.2 fails due to an invalid escape character error during cmake. this is probably bc 3956955 introduced REACT_ANDROID_DIR for cmake, but not escaping \ to / like BUILD_DIR did.

I just added REACT_ANDROID_DIR \ escaping under the CMAKE_HOST_WIN32 if above and it works again. like

if(CMAKE_HOST_WIN32)
        string(REPLACE "\\" "/" BUILD_DIR ${BUILD_DIR})
        string(REPLACE "\\" "/" REACT_ANDROID_DIR ${REACT_ANDROID_DIR})

Steps to reproduce

build 0.76.2 on windows

React Native Version

0.76.2

Affected Platforms

Build - Windows

Output of npx react-native info

n/a

Stacktrace or Logs

n/a

Reproducer

n/a

Screenshots and Videos

No response

Thankyou this solution worked for me :)

@HITESHDALVI
Copy link

@lovegaoshi , Thanks saved a lot of time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.76 Needs: Author Feedback Needs: React Native Team Attention Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants