clipboard: [Android-New Arch] Cannot specify link libraries for target "react_codegen_RNCClipboard" which is not built by this project

Environment

System: OS: macOS 13.2.1 CPU: (8) arm64 Apple M1 Memory: 100.86 MB / 16.00 GB Shell: version: 5.8.1 path: /bin/zsh Binaries: Node: version: 18.17.1 path: ~/.nvm/versions/node/v18.17.1/bin/node Yarn: version: 1.22.19 path: /opt/homebrew/bin/yarn npm: version: 9.6.7 path: ~/.nvm/versions/node/v18.17.1/bin/npm Watchman: version: 2023.01.23.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /usr/local/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 22.4 - iOS 16.4 - macOS 13.3 - tvOS 16.4 - watchOS 9.4 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.10121639 Xcode: version: 14.3.1/14E300c path: /usr/bin/xcodebuild Languages: Java: version: 11.0.18 path: /usr/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: “@react-native-community/cli”: Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.5 wanted: ^0.72.4 react-native-macos: Not Found npmGlobalPackages: “react-native”: Not Found Android: hermesEnabled: true newArchEnabled: true iOS: hermesEnabled: true newArchEnabled: false

Platforms

Android

Versions

Description

  • Build Fail with new architecture enabled
> Task :app:configureCMakeDebug[arm64-v8a] FAILED
C/C++: CMake Error at /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:8 (add_subdirectory):
C/C++:   add_subdirectory given source
C/C++:   "/Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/@react-native-clipboard/clipboard/android/build/generated/source/codegen/jni/"
C/C++:   which is not an existing directory.
C/C++: Call Stack (most recent call first):
C/C++:   /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
C/C++:   CMakeLists.txt:31 (include)
C/C++: CMake Error at /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:124 (target_link_libraries):
C/C++:   Cannot specify link libraries for target "react_codegen_RNCClipboard" which
C/C++:   is not built by this project.
C/C++: Call Stack (most recent call first):
C/C++:   CMakeLists.txt:31 (include)
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.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/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings
582 actionable tasks: 559 executed, 23 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

No modules to process in combine-js-to-schema-cli. If this is unexpected, please check if you set up your NativeComponent correctly. See combine-js-to-schema.js for how codegen finds modules.
No modules to process in combine-js-to-schema-cli. If this is unexpected, please check if you set up your NativeComponent correctly. See combine-js-to-schema.js for how codegen finds modules.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/@react-native-async-storage/async-storage/android/src/javaPackage/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native-camera/android/src/main/java/com/google/android/cameraview/Camera2.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/@react-native-camera-roll/camera-roll/android/src/main/java/com/reactnativecommunity/cameraroll/CameraRollModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/@react-native-camera-roll/camera-roll/android/src/main/java/com/reactnativecommunity/cameraroll/CameraRollPackage.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/@react-native-clipboard/clipboard/android/src/main/java/com/reactnativecommunity/clipboard/ClipboardModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native-document-picker/android/src/main/java/com/reactnativedocumentpicker/DocumentPickerModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: [2] Wrote GeneratedAppGlideModule with: [com.bumptech.glide.integration.okhttp3.OkHttpLibraryGlideModule, com.dylanvann.fastimage.FastImageOkHttpProgressGlideModule]
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native-image-picker/android/src/main/java/com/imagepicker/Utils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native-localization/android/src/main/java/com/babisoft/ReactNativeLocalization/ReactNativeLocalization.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native-navigation-bar-color/android/src/main/java/com/thebylito/navigationbarcolor/NavigationBarColorModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native-permissions/android/src/main/java/com/zoontek/rnpermissions/RNPermissionsPackage.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native-sensitive-info/android/src/main/java/dev/mcodex/RNSensitiveInfoModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/VirtualView.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native-vector-icons/android/src/newarch/java/com/oblador/vectoricons/VectorIconsModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native-version-number/android/src/main/java/com/apsl/versionnumber/RNVersionNumberModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native-video/android/src/main/java/com/brentvatne/react/ReactVideoViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/rn-android-keyboard-adjust/android/src/main/java/com/tclado/androidkeyboardadjust/RnAndroidKeyboardAdjustModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:configureCMakeDebug[arm64-v8a]'.
> [CXX1429] error when building with cmake using /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup/CMakeLists.txt: -- Configuring incomplete, errors occurred!
  See also "/Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/android/app/.cxx/Debug/c3rr5x5t/arm64-v8a/CMakeFiles/CMakeOutput.log".

  C++ build system [configure] failed while executing:
      /Users/thucnguyenduy/Library/Android/sdk/cmake/3.22.1/bin/cmake \
        -H/Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native/ReactAndroid/cmake-utils/default-app-setup \
        -DCMAKE_SYSTEM_NAME=Android \
        -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
        -DCMAKE_SYSTEM_VERSION=21 \
        -DANDROID_PLATFORM=android-21 \
        -DANDROID_ABI=arm64-v8a \
        -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
        -DANDROID_NDK=/Users/thucnguyenduy/Library/Android/sdk/ndk/23.1.7779620 \
        -DCMAKE_ANDROID_NDK=/Users/thucnguyenduy/Library/Android/sdk/ndk/23.1.7779620 \
        -DCMAKE_TOOLCHAIN_FILE=/Users/thucnguyenduy/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake \
        -DCMAKE_MAKE_PROGRAM=/Users/thucnguyenduy/Library/Android/sdk/cmake/3.22.1/bin/ninja \
        -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/android/app/build/intermediates/cxx/Debug/c3rr5x5t/obj/arm64-v8a \
        -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/android/app/build/intermediates/cxx/Debug/c3rr5x5t/obj/arm64-v8a \
        -DCMAKE_BUILD_TYPE=Debug \
        -DCMAKE_FIND_ROOT_PATH=/Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/android/app/.cxx/Debug/c3rr5x5t/prefab/arm64-v8a/prefab \
        -B/Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/android/app/.cxx/Debug/c3rr5x5t/arm64-v8a \
        -GNinja \
        -DPROJECT_BUILD_DIR=/Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/android/app/build \
        -DREACT_ANDROID_DIR=/Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native/ReactAndroid \
        -DANDROID_STL=c++_shared \
        -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=ON
    from /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/android/app
  CMake Error at /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:8 (add_subdirectory):
    add_subdirectory given source
    "/Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/@react-native-clipboard/clipboard/android/build/generated/source/codegen/jni/"
    which is not an existing directory.
  Call Stack (most recent call first):
    /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:121 (include)
    CMakeLists.txt:31 (include)


  CMake Error at /Users/thucnguyenduy/Documents/mobile/SubWallet-Mobile/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:124 (target_link_libraries):
    Cannot specify link libraries for target "react_codegen_RNCClipboard" which
    is not built by this project.
  Call Stack (most recent call first):
    CMakeLists.txt:31 (include)

Reproducible Demo

  • Update gradle.properties: newArchEnabled=true
  • Add react-native.config.js to enable Interop Layer:
module.exports = {
  project: {
    android: {
      unstable_reactLegacyComponentNames: [
        'RNCAsyncStorage',
        'RNVectorIcons',
        'BVLinearGradient',
        'RNCMaskedView',
        'RNSVG',
        'RNSVGImage',
        'RNReanimated',
        'RNCamera',
        'FastImageView',
      ],
    },
    ios: {
      unstable_reactLegacyComponentNames: [
        'RNCAsyncStorage',
        'RNVectorIcons',
        'BVLinearGradient',
        'RNCMaskedView',
        'RNSVG',
        'RNSVGImage',
        'RNReanimated',
        'RNCamera',
      ],
    },
  },
};
  • In terminal run: yarn android or ./gradlew assembleRelease
  • Error occurred
  • Note: If i remove "@react-native-clipboard/clipboard": "^1.12.1", from package.json and build again, then build successfully

About this issue

  • Original URL
  • State: open
  • Created 9 months ago
  • Reactions: 9
  • Comments: 15

Most upvoted comments

Version 1.11.2 is worked for me.

Make sure you have

"@react-native-clipboard/clipboard": "1.11.2",

without ^

Downgrading to v1.11.1 solved the issue for me.

tried with v1.11.2 work for me

@dankocher have you tried with deleting node module and reinstall app

Yes, I tried it. But not worked. Only worked after remove ^

Downgrading to v1.11.1 solved the issue for me.

Didn’t work for me 😦

Delete node_modules and reinstall dependencies. Also, I recommend using Android Studio to build your project. That way you get more insightful debugging information.

Downgrading to v1.11.1 solved the issue for me.

Didn’t work for me 😦

Facing this same issue, any solution ?