facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.8k stars 24.29k forks source link

Task :app:configureCMakeDebug[arm64-v8a] FAILED #37124

Closed avioXD closed 1 year ago

avioXD commented 1 year ago

Description

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:configureCMakeDebug[arm64-v8a]'.
> [CXX1405] error when building with cmake using D:\DATASPACE\Dataspace Academy Mobile APP\NEW-RELASE\DataspaceAcademy\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt: -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: C:/Users/abhis/AppData/Local/Android/Sdk/ndk/25.2.9519653/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: C:/Users/abhis/AppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring incomplete, errors occurred!
  See also "D:/DATASPACE/Dataspace Academy Mobile APP/NEW-RELASE/DataspaceAcademy/android/app/.cxx/Debug/p6z2k1x3/arm64-v8a/CMakeFiles/CMakeOutput.log".

  C++ build system [configure] failed while executing:
      @echo off
      "C:\\Users\\abhis\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\cmake.exe" ^
        "-HD:\\DATASPACE\\Dataspace Academy Mobile APP\\NEW-RELASE\\DataspaceAcademy\\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=C:\\Users\\abhis\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653" ^
        "-DCMAKE_ANDROID_NDK=C:\\Users\\abhis\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653" ^
        "-DCMAKE_TOOLCHAIN_FILE=C:\\Users\\abhis\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653\\build\\cmake\\android.toolchain.cmake" ^
        "-DCMAKE_MAKE_PROGRAM=C:\\Users\\abhis\\AppData\\Local\\Android\\Sdk\\cmake\\3.18.1\\bin\\ninja.exe" ^
        "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\\DATASPACE\\Dataspace Academy Mobile APP\\NEW-RELASE\\DataspaceAcademy\\android\\app\\build\\intermediates\\cxx\\Debug\\p6z2k1x3\\obj\\arm64-v8a" ^
        "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=D:\\DATASPACE\\Dataspace Academy Mobile APP\\NEW-RELASE\\DataspaceAcademy\\android\\app\\build\\intermediates\\cxx\\Debug\\p6z2k1x3\\obj\\arm64-v8a" ^
        "-DCMAKE_BUILD_TYPE=Debug" ^
        "-DCMAKE_FIND_ROOT_PATH=D:\\DATASPACE\\Dataspace Academy Mobile APP\\NEW-RELASE\\DataspaceAcademy\\android\\app\\.cxx\\Debug\\p6z2k1x3\\prefab\\arm64-v8a\\prefab" ^   
        "-BD:\\DATASPACE\\Dataspace Academy Mobile APP\\NEW-RELASE\\DataspaceAcademy\\android\\app\\.cxx\\Debug\\p6z2k1x3\\arm64-v8a" ^
        -GNinja ^
        "-DPROJECT_BUILD_DIR=D:\\DATASPACE\\Dataspace Academy Mobile APP\\NEW-RELASE\\DataspaceAcademy\\android\\app\\build" ^
        "-DREACT_ANDROID_DIR=D:\\DATASPACE\\Dataspace Academy Mobile APP\\NEW-RELASE\\DataspaceAcademy\\node_modules\\react-native\\ReactAndroid" ^
        "-DANDROID_STL=c++_shared"
    from D:\DATASPACE\Dataspace Academy Mobile APP\NEW-RELASE\DataspaceAcademy\android\app
  CMake Warning at C:/Users/abhis/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android-legacy.toolchain.cmake:418 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    C:/Users/abhis/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake:54 (include)
    C:/Users/abhis/AppData/Local/Android/Sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeDetermineSystem.cmake:93 (include)
    CMakeLists.txt:28 (project)

  CMake Warning at C:/Users/abhis/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android-legacy.toolchain.cmake:418 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    C:/Users/abhis/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake:54 (include)
    D:/DATASPACE/Dataspace Academy Mobile APP/NEW-RELASE/DataspaceAcademy/android/app/.cxx/Debug/p6z2k1x3/arm64-v8a/CMakeFiles/3.18.1-g262b901-dirty/CMakeSystem.cmake:6 (include)
    D:/DATASPACE/Dataspace Academy Mobile APP/NEW-RELASE/DataspaceAcademy/android/app/.cxx/Debug/p6z2k1x3/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)

  CMake Warning at C:/Users/abhis/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android-legacy.toolchain.cmake:418 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    C:/Users/abhis/AppData/Local/Android/Sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake:54 (include)
    D:/DATASPACE/Dataspace Academy Mobile APP/NEW-RELASE/DataspaceAcademy/android/app/.cxx/Debug/p6z2k1x3/arm64-v8a/CMakeFiles/3.18.1-g262b901-dirty/CMakeSystem.cmake:6 (include)
    D:/DATASPACE/Dataspace Academy Mobile APP/NEW-RELASE/DataspaceAcademy/android/app/.cxx/Debug/p6z2k1x3/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)

  CMake Error at D:/DATASPACE/Dataspace Academy Mobile APP/NEW-RELASE/DataspaceAcademy/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:6 (add_subdirectory):
    add_subdirectory called with incorrect number of arguments
  Call Stack (most recent call first):
    D:/DATASPACE/Dataspace Academy Mobile APP/NEW-RELASE/DataspaceAcademy/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:106 (include)       
    CMakeLists.txt:31 (include)

  CMake Error at D:/DATASPACE/Dataspace Academy Mobile APP/NEW-RELASE/DataspaceAcademy/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:7 (add_subdirectory):
    add_subdirectory called with incorrect number of arguments
  Call Stack (most recent call first):
    D:/DATASPACE/Dataspace Academy Mobile APP/NEW-RELASE/DataspaceAcademy/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:106 (include)       
    CMakeLists.txt:31 (include)

  CMake Error at D:/DATASPACE/Dataspace Academy Mobile APP/NEW-RELASE/DataspaceAcademy/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:109 (target_link_libraries):
    Cannot specify link libraries for target "react_codegen_RNCViewPager" which
    is not built by this project.
  Call Stack (most recent call first):
    CMakeLists.txt:31 (include)

* 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:
java.lang.StackOverflowError (no error message)

* 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.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 42s
324 actionable tasks: 319 executed, 5 up-to-date`

React Native Version

0.71.4

Output of npx react-native info

`` System: OS: Windows 10 10.0.22621 CPU: (12) ia32 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 3.20 GB / 15.87 GB Binaries: Node: 18.15.0 - C:\Program Files (x86)\nodejs\node.EXE Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD npm: 9.5.0 - C:\Program Files (x86)\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: AI-221.6008.13.2211.9514443 Visual Studio: Not Found Languages: Java: 11.0.17 npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.4 => 0.71.4 react-native-windows: Not Found npmGlobalPackages: react-native: Not Found


### Steps to reproduce

**app/build.gradle**

apply plugin: "com.android.application" apply plugin: "com.facebook.react"

import com.android.build.OutputFile

/**

/**

/**

/**

/**

android { ndkVersion rootProject.ext.ndkVersion compileSdkVersion rootProject.ext.compileSdkVersion compileOptions { sourceCompatibility 1.8 targetCompatibility 1.8 } namespace "com.dataspaceacademy" defaultConfig { applicationId "com.dataspaceacademy" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" multiDexEnabled true }

splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include (*reactNativeArchitectures())
    }
}
signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://reactnative.dev/docs/signed-apk-android.
        signingConfig signingConfigs.debug
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // https://developer.android.com/studio/build/configure-apk-splits.html
        // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
        def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    defaultConfig.versionCode * 1000 + versionCodes.get(abi)
        }

    }
}

}

dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") implementation 'com.android.support:multidex:2.0.1' implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0") implementation platform('com.google.firebase:firebase-bom:31.5.0') implementation 'com.google.firebase:firebase-analytics' debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.squareup.okhttp3', module:'okhttp' }

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
    implementation("com.facebook.react:hermes-android")
} else {
    implementation jscFlavor
}

} project.ext.vectoricons = [ iconFontNames: [ 'MaterialIcons.ttf', 'EvilIcons.ttf' , 'FontAwesome.ttf' ,"MaterialCommunityIcons", "Ionicons.ttf", "Feather.ttf", "FontAwesome5.ttf", "AntDesign.ttf", "Entypo.ttf", "SimpleLineIcons.ttf", "Octicons.ttf", "Foundation.ttf", ] // Name of the font files you want to copy ] apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"



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

I tried to implement firebase push notification into my project then this problem occurred.
github-actions[bot] commented 1 year ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
avioXD commented 1 year ago

Task :app:compileDebugJavaWithJavac FAILED D:\DATASPACE\Dataspace Academy Mobile APP\NEW-RELASE\DataspaceAcademy\android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:37: error: package com.swmansion.reanimated does not exist import com.swmansion.reanimated.ReanimatedPackage; ^ D:\DATASPACE\Dataspace Academy Mobile APP\NEW-RELASE\DataspaceAcademy\android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:108: error: cannot find symbol new ReanimatedPackage(), ^ symbol: class ReanimatedPackage location: class PackageList 2 errors w: Detected multiple Kotlin daemon sessions at build\kotlin\sessions

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

2: Task failed with an exception.

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.5.1/userguide/command_line_interface.html#sec:command_line_warnings

Now getting this error

cortinico commented 1 year ago

Have you turned on the New Architecture @avioXD ?

avioXD commented 1 year ago

I am so new to it. I guess no. Can you help me?

avioXD commented 1 year ago
package com.dataspaceacademy;

import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
import com.facebook.react.defaults.DefaultReactActivityDelegate;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;

public class MainActivity extends ReactActivity {
  @Override
  protected String getMainComponentName() {
    return "YourAppName";
  }

  @Override
  protected ReactActivityDelegate createReactActivityDelegate() {
    return new ReactActivityDelegate(this, getMainComponentName(),
        DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled
        // If you opted-in for the New Architecture, we enable Concurrent React (i.e.
        // React 18).
        DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled
    ) {
      @Override
      protected ReactNativeHost getReactNativeHost() {
        return new ReactNativeHost(MainActivity.this) {
          @Override
          protected boolean getUseDeveloperSupport() {
            return BuildConfig.DEBUG;
          }

          @Override
          protected List<ReactPackage> getPackages() {
            List<ReactPackage> packages = new PackageList(this).getPackages();
            packages.add(new ReanimatedJSIModulePackage()); // Add this line
            return packages;
          }
        };
      }
    };
  }
}
cortinico commented 1 year ago

I am so new to it. I guess no. Can you help me?

I believe you did. The New Architecture is experimental at the moment. You can turn it off on Android by changing the:

-newArchEnabled=true
+newArchEnabled=false

in your android/app/gradle.properties file.

MaryamShakir commented 11 months ago

I am encountering this error . actually I clone a project and after cloning when I run the project I encounter this error . I tried to rsolve it by using many ways but fail . Build failed with an exception.

BUILD FAILED in 53s error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:configureCMakeDebug[arm64-v8a]'. > [CXX1429] error when building with cmake using E:\mana_app\node_modules\react-native\ReactAndroid\cmake-utils\default-app-setup\CMakeLists.txt: -- The C compiler identification is Clang 12.0.8 -- The CXX compiler identification is Clang 12.0.8 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Users/Welcome/AppData/Local/Android/Sdk/ndk/23.1.7779620/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: C:/Users/Welcome/AppData/Local/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring incomplete, errors occurred! See also "E:/mana_app/android/app/.cxx/Debug/3s3m254i/arm64-v8a/CMakeFiles/CMakeOutput.log". C++ build system [configure] failed while executing: @echo off "C:\Users\Welcome\AppData\Local\Android\Sdk\cmake\3.22.1\bin\cmake.exe" ^ "-HE:\mana_app\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=C:\Users\Welcome\AppData\Local\Android\Sdk\ndk\23.1.7779620" ^ "-DCMAKE_ANDROID_NDK=C:\Users\Welcome\AppData\Local\Android\Sdk\ndk\23.1.7779620" ^ "-DCMAKE_TOOLCHAIN_FILE=C:\Users\Welcome\AppData\Local\Android\Sdk\ndk\23.1.7779620\build\cmake\android.toolchain.cmake" ^ "-DCMAKE_MAKE_PROGRAM=C:\Users\Welcome\AppData\Local\Android\Sdk\cmake\3.22.1\bin\ninja.exe" ^ "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=E:\mana_app\android\app\build\intermediates\cxx\Debug\3s3m254i\obj\arm64-v8a" ^ "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=E:\mana_app\android\app\build\intermediates\cxx\Debug\3s3m254i\obj\arm64-v8a" ^ "-DCMAKE_BUILD_TYPE=Debug" ^ "-DCMAKE_FIND_ROOT_PATH=E:\mana_app\android\app\.cxx\Debug\3s3m254i\prefab\arm64-v8a\prefab" ^ "-BE:\mana_app\android\app\.cxx\Debug\3s3m254i\arm64-v8a" ^ -GNinja ^ "-DPROJECT_BUILD_DIR=E:\mana_app\android\app\build" ^ "-DREACT_ANDROID_DIR=E:\mana_app\node_modules\react-native\ReactAndroid" ^ "-DANDROID_STL=c++_shared" ^ "-DANDROID_USE_LEGACY_TOOLCHAIN_FILE=ON" from E:\mana_app\

Any One please help me how to resolve this.

GNUGradyn commented 5 months ago

Why was this closed? Issue still exists when new arc is enabled

mpanac commented 4 months ago

Yea i am facing the same issue when newArchitecture is enabled