question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

rn-tester Android build fails on main

See original GitHub issue

Description

I’m trying to run the rn-tester app, building React Native from source on Android.

I’m on the current main branch, and have no diff, and I believe I’ve met all the prerequisites for building from source.

However, I’m consistently seeing a gradle build error:

> Task :ReactAndroid:configureCMakeDebug[x86_64] FAILED
C/C++: debug|x86_64 :CMake Error at CMakeLists.txt:16 (add_subdirectory):
C/C++: debug|x86_64 :  The source directory
C/C++: debug|x86_64 :    /Users/roryabraham/react-native/ReactAndroid/build/generated/source/codegen/jni
C/C++: debug|x86_64 :  does not contain a CMakeLists.txt file.
C/C++: debug|x86_64 :Call Stack (most recent call first):
C/C++: debug|x86_64 :  CMakeLists.txt:87 (add_react_android_subdir)

FAILURE: Build completed with 4 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':ReactAndroid:configureCMakeDebug[arm64-v8a]'.
> [CXX1405] error when building with cmake using /Users/roryabraham/react-native/ReactAndroid/src/main/jni/CMakeLists.txt: Build command failed.
  Error while executing process /Users/roryabraham/Library/Android/sdk/cmake/3.18.1/bin/cmake with arguments {-H/Users/roryabraham/react-native/ReactAndroid/src/main/jni -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=21 -DANDROID_ABI=arm64-v8a -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DANDROID_NDK=/Users/roryabraham/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_ANDROID_NDK=/Users/roryabraham/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_TOOLCHAIN_FILE=/Users/roryabraham/Library/Android/sdk/ndk/21.4.7075529/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/Users/roryabraham/Library/Android/sdk/cmake/3.18.1/bin/ninja -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/roryabraham/react-native/ReactAndroid/build/intermediates/cxx/Debug/272l665q/obj/arm64-v8a -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/roryabraham/react-native/ReactAndroid/build/intermediates/cxx/Debug/272l665q/obj/arm64-v8a -DCMAKE_BUILD_TYPE=Debug -DCMAKE_FIND_ROOT_PATH=/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/prefab/arm64-v8a/prefab -B/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/arm64-v8a -GNinja -DREACT_COMMON_DIR=/Users/roryabraham/react-native/ReactCommon -DREACT_ANDROID_DIR=/Users/roryabraham/react-native/ReactAndroid -DANDROID_STL=c++_shared -DANDROID_TOOLCHAIN=clang -DANDROID_PLATFORM=android-21}
  -- Configuring incomplete, errors occurred!
  See also "/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/arm64-v8a/CMakeFiles/CMakeOutput.log".
  See also "/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/arm64-v8a/CMakeFiles/CMakeError.log".
  
  CMake Error at CMakeLists.txt:16 (add_subdirectory):
    The source directory
  
      /Users/roryabraham/react-native/ReactAndroid/build/generated/source/codegen/jni
  
    does not contain a CMakeLists.txt file.
  Call Stack (most recent call first):
    CMakeLists.txt:87 (add_react_android_subdir)
  
  


* 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 ':ReactAndroid:configureCMakeDebug[armeabi-v7a]'.
> [CXX1405] error when building with cmake using /Users/roryabraham/react-native/ReactAndroid/src/main/jni/CMakeLists.txt: Build command failed.
  Error while executing process /Users/roryabraham/Library/Android/sdk/cmake/3.18.1/bin/cmake with arguments {-H/Users/roryabraham/react-native/ReactAndroid/src/main/jni -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=21 -DANDROID_ABI=armeabi-v7a -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DANDROID_NDK=/Users/roryabraham/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_ANDROID_NDK=/Users/roryabraham/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_TOOLCHAIN_FILE=/Users/roryabraham/Library/Android/sdk/ndk/21.4.7075529/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/Users/roryabraham/Library/Android/sdk/cmake/3.18.1/bin/ninja -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/roryabraham/react-native/ReactAndroid/build/intermediates/cxx/Debug/272l665q/obj/armeabi-v7a -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/roryabraham/react-native/ReactAndroid/build/intermediates/cxx/Debug/272l665q/obj/armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DCMAKE_FIND_ROOT_PATH=/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/prefab/armeabi-v7a/prefab -B/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/armeabi-v7a -GNinja -DREACT_COMMON_DIR=/Users/roryabraham/react-native/ReactCommon -DREACT_ANDROID_DIR=/Users/roryabraham/react-native/ReactAndroid -DANDROID_STL=c++_shared -DANDROID_TOOLCHAIN=clang -DANDROID_PLATFORM=android-21}
  -- Configuring incomplete, errors occurred!
  See also "/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/armeabi-v7a/CMakeFiles/CMakeOutput.log".
  See also "/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/armeabi-v7a/CMakeFiles/CMakeError.log".
  
  CMake Error at CMakeLists.txt:16 (add_subdirectory):
    The source directory
  
      /Users/roryabraham/react-native/ReactAndroid/build/generated/source/codegen/jni
  
    does not contain a CMakeLists.txt file.
  Call Stack (most recent call first):
    CMakeLists.txt:87 (add_react_android_subdir)
  
  


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

3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':ReactAndroid:configureCMakeDebug[x86]'.
> [CXX1405] error when building with cmake using /Users/roryabraham/react-native/ReactAndroid/src/main/jni/CMakeLists.txt: Build command failed.
  Error while executing process /Users/roryabraham/Library/Android/sdk/cmake/3.18.1/bin/cmake with arguments {-H/Users/roryabraham/react-native/ReactAndroid/src/main/jni -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=21 -DANDROID_ABI=x86 -DCMAKE_ANDROID_ARCH_ABI=x86 -DANDROID_NDK=/Users/roryabraham/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_ANDROID_NDK=/Users/roryabraham/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_TOOLCHAIN_FILE=/Users/roryabraham/Library/Android/sdk/ndk/21.4.7075529/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/Users/roryabraham/Library/Android/sdk/cmake/3.18.1/bin/ninja -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/roryabraham/react-native/ReactAndroid/build/intermediates/cxx/Debug/272l665q/obj/x86 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/roryabraham/react-native/ReactAndroid/build/intermediates/cxx/Debug/272l665q/obj/x86 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_FIND_ROOT_PATH=/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/prefab/x86/prefab -B/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/x86 -GNinja -DREACT_COMMON_DIR=/Users/roryabraham/react-native/ReactCommon -DREACT_ANDROID_DIR=/Users/roryabraham/react-native/ReactAndroid -DANDROID_STL=c++_shared -DANDROID_TOOLCHAIN=clang -DANDROID_PLATFORM=android-21}
  -- Configuring incomplete, errors occurred!
  See also "/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/x86/CMakeFiles/CMakeOutput.log".
  See also "/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/x86/CMakeFiles/CMakeError.log".
  
  CMake Error at CMakeLists.txt:16 (add_subdirectory):
    The source directory
  
      /Users/roryabraham/react-native/ReactAndroid/build/generated/source/codegen/jni
  
    does not contain a CMakeLists.txt file.
  Call Stack (most recent call first):
    CMakeLists.txt:87 (add_react_android_subdir)
  
  


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

4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':ReactAndroid:configureCMakeDebug[x86_64]'.
> [CXX1405] error when building with cmake using /Users/roryabraham/react-native/ReactAndroid/src/main/jni/CMakeLists.txt: Build command failed.
  Error while executing process /Users/roryabraham/Library/Android/sdk/cmake/3.18.1/bin/cmake with arguments {-H/Users/roryabraham/react-native/ReactAndroid/src/main/jni -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=21 -DANDROID_ABI=x86_64 -DCMAKE_ANDROID_ARCH_ABI=x86_64 -DANDROID_NDK=/Users/roryabraham/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_ANDROID_NDK=/Users/roryabraham/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_TOOLCHAIN_FILE=/Users/roryabraham/Library/Android/sdk/ndk/21.4.7075529/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/Users/roryabraham/Library/Android/sdk/cmake/3.18.1/bin/ninja -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/roryabraham/react-native/ReactAndroid/build/intermediates/cxx/Debug/272l665q/obj/x86_64 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/roryabraham/react-native/ReactAndroid/build/intermediates/cxx/Debug/272l665q/obj/x86_64 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_FIND_ROOT_PATH=/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/prefab/x86_64/prefab -B/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/x86_64 -GNinja -DREACT_COMMON_DIR=/Users/roryabraham/react-native/ReactCommon -DREACT_ANDROID_DIR=/Users/roryabraham/react-native/ReactAndroid -DANDROID_STL=c++_shared -DANDROID_TOOLCHAIN=clang -DANDROID_PLATFORM=android-21}
  -- Configuring incomplete, errors occurred!
  See also "/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/x86_64/CMakeFiles/CMakeOutput.log".
  See also "/Users/roryabraham/react-native/ReactAndroid/.cxx/Debug/272l665q/x86_64/CMakeFiles/CMakeError.log".
  
  CMake Error at CMakeLists.txt:16 (add_subdirectory):
    The source directory
  
      /Users/roryabraham/react-native/ReactAndroid/build/generated/source/codegen/jni
  
    does not contain a CMakeLists.txt file.
  Call Stack (most recent call first):
    CMakeLists.txt:87 (add_react_android_subdir)
  
  


* 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 19s
80 actionable tasks: 16 executed, 64 up-to-date

Version

0.68.1

Output of npx react-native info

Run from packages/rn-tester:

npx react-native info                                                                  
info Fetching system and libraries information...
System:
    OS: macOS 12.3.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 990.08 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.19.0 - ~/.nvm/versions/node/v14.19.0/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 6.14.16 - ~/.nvm/versions/node/v14.19.0/bin/npm
    Watchman: 2022.02.21.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: Not Found
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: Bumblebee 2021.1.1 Patch 3 Bumblebee 2021.1.1 Patch 3
    Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  1. Clone this repo.
  2. yarn install && cd packages/rn-tester && yarn install
  3. Ensure JAVA_HOME is Java 11
  4. Open this repo in Android Studio
  5. Go to Preferences -> Appearance & Behavior -> System Settings -> Android SDK -> SDK Platforms and ensure that you install the Android SDK that matches the buildToolVersions from ReactAndroid/build.gradle (currently 31 at the time of writing).
  6. Go to Preferences -> Appearance & Behavior -> System Settings -> Android SDK -> SDK Tools and ensure that you install NDK (Side by side)
  7. Run cd packages/rn-tester && yarn install-android-hermes

Snack, code example, screenshot, or link to a repository

No diff is required, this is happening on the main branch of this repo.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cortinicocommented, May 2, 2022

Main does seem broken (due to the migration to CMake from Android.mk), but I think I should close this for now.

Thanks for reporting this. The issue should be resolved by now (it required a bump of the Codegen + a revert of a commit that was preventing RN Tester from starting).

0reactions
cortinicocommented, May 19, 2022

Doesn’t seem fixed, although our exact error is a bit different.

Are you talking about main having RN-Tester broken? As this was the original issue. Please open a new issue reporting what is not working in your case and if it’s related to rn-tester or not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Android build failure with different errors without ...
The build failures for Android was due to the publish of the React Native version 0.71.0-rc0 . Note: Error may be different but...
Read more >
How to Test a Release - React Native
Delete RNTester and RNTestProject from your Android emulator and iOS ... For main branch, and versions of RN >=0.71, you can instead use ......
Read more >
Dealing With Problems With Building the App & Detox
Execution failed for task ':app:processReleaseAndroidTestResources'. > A failure occurred while executing com.android.build.gradle.internal.res.
Read more >
[From the React team] Fix and updates on Android build ...
The last two days have been frustrating and stressful following the rabbit holes of different error fixes that only lead to more errors....
Read more >
Gradle build after JCenter shutdown - Microsoft Learn
If you use JCenter and Bintray resources in your AppCenter Android builds and your builds fail on Gradle Task failure (could not get ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found