Skip to content

Android CMake build fails: Cannot specify link libraries for target "react_codegen_lottiereactnative" which is not built by this project (RN 0.85.x) #56420

@Leo-8991

Description

@Leo-8991

Description

Environment:

React Native version: 0.85.0
Gradle: 8.13
NDK: 27.1.12297006
CMake: 3.22.1
macOS
Key native modules: lottie-react-native, react-native-config, react-native-gesture-handler, NitroModules

Description:
When building a React Native 0.85.x Android app with native modules like lottie-react-native, NitroModules, and others, the CMake-based autolinking/codegen system tries to link to codegen targets (e.g., react_codegen_lottiereactnative) that do not exist or are not built by the project. This results in CMake errors and a failed build, even if all required dummy files and directories are present.

Steps to reproduce

  1. Upgrade to React Native 0.85.x and update all related dependencies.
  2. Run yarn install and cd android && ./gradlew clean.
  3. Run yarn android.
  4. Observe the build failure.

React Native Version

0.85.0

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

System:
  OS: macOS 26.3.1
  CPU: (10) arm64 Apple M4
  Memory: 107.83 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.20.0
    path: /Users/Karthik/.nvm/versions/node/v20.20.0/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 11.12.1
    path: /Users/Karthik/.nvm/versions/node/v20.20.0/bin/npm
  Watchman:
    version: 2026.03.30.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/lib/ruby/gems/3.4.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.4
      - iOS 26.4
      - macOS 26.4
      - tvOS 26.4
      - visionOS 26.4
      - watchOS 26.4
  Android SDK:
    API Levels:
      - "33"
      - "34"
      - "35"
      - "36"
    Build Tools:
      - 30.0.3
      - 33.0.2
      - 34.0.0
      - 35.0.0
      - 36.0.0
    System Images:
      - android-35 | Google APIs ARM 64 v8a
      - android-36 | Google Play ARM 64 v8a
      - android-36 | Pre-Release 16 KB Page Size Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2025.3 AI-253.31033.145.2533.15113396
  Xcode:
    version: 26.4/17E192
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.18
    path: /opt/homebrew/opt/openjdk@17/bin/javac
  Ruby:
    version: 4.0.2
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.1
    wanted: 19.1.1
  react-native:
    installed: 0.85.0
    wanted: 0.85.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

CMake Error at .../Android-autolinking.cmake:13 (add_subdirectory):
  The source directory
    .../node_modules/lottie-react-native/android/build/generated/source/codegen/jni
  does not contain a CMakeLists.txt file.
...
CMake Error at .../ReactNative-application.cmake:97 (target_link_libraries):
  Cannot specify link libraries for target "react_codegen_lottiereactnative"
  which is not built by this project.
Call Stack (most recent call first):
  CMakeLists.txt:31 (include)

MANDATORY Reproducer

My project, there is no RNTesterPlayground

Screenshots and Videos

What I tried:
Created dummy CMakeLists.txt and dummy.cpp files for all affected modules.
Cleaned all build outputs and node_modules.
Verified all directory paths.
The error persists on every build.

Expected behavior:
The build should succeed, or the autolinking/codegen system should not reference missing/broken targets.

Actual behavior:
The build fails with CMake errors about missing codegen targets and link libraries.

Additional context:
This blocks all Android builds with NitroModules and lottie-react-native on RN 0.85.x.
All known workarounds have been exhausted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions