react-native-reanimated icon indicating copy to clipboard operation
react-native-reanimated copied to clipboard

Android build fails in new architecture

Open Maribhuvan opened this issue 3 years ago • 4 comments

Description

> Configure project :react-native-reanimated
Native libs debug enabled: false
Android gradle plugin: 7.2.1
Gradle: 7.5.1
building Reanimated2
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.

> Task :react-native-reanimated:downloadHermes
Download https://github.com/facebook/hermes/tarball/hermes-2022-09-14-RNv0.70.1-2a6b111ab289b55d7b78b5fdf105f466ba270fd7

> Task :react-native-reanimated:compileDebugJavaWithJavac
Execution optimizations have been disabled for task ':react-native-reanimated:compileDebugJavaWithJavac' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'sample\node_modules\react-native-reanimated\android\src\main\java'. Reason: Task ':react-native-reanimated:compileDebugJavaWithJavac' uses this output of task ':react-native-reanimated:applyJavaPatches' without declaring an explicit or implicit dependency. 
This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.

> Task :react-native-reanimated:downloadBoost
Download https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz

> Task :react-native-gesture-handler:compileDebugKotlin
w: sample\node_modules\react-native-gesture-handler\android\lib\src\main\java\com\swmansion\gesturehandler\GestureHandler.kt: (727, 11): Name shadowed: size
w: sample\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEnabledRootView.kt: (13, 51): Unreachable code
w: sample\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEnabledRootView.kt: (14, 80): Unreachable code
w:sample\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRootHelper.kt: (75, 18): 'onChildStartedNativeGesture(MotionEvent!): Unit' 
is deprecated. Deprecated in Java
w: sample\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRootHelper.kt: (80, 42): Parameter 'disallowIntercept' is never used       
w: sample\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRootHelper.kt: (112, 28): Parameter 'viewTag' is never used
w: sample\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerTouchEvent.kt: (7, 44): 'RCTEventEmitter' is deprecated. Deprecated in Javaw: sample\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerTouchEvent.kt: (14, 11): 'init(Int): Unit' is deprecated. Deprecated in Java
w: sample\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerTouchEvent.kt: (30, 42): 'RCTEventEmitter' is deprecated. Deprecated in Java
w: sample\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerTouchEvent.kt: (31, 21): 'receiveEvent(Int, String!, WritableMap?): Unit' is deprecated. Deprecated in Java

> Task :react-native-reanimated:downloadDoubleConversion
Download https://github.com/google/double-conversion/archive/v1.1.6.tar.gz

> Task :react-native-reanimated:downloadGlog
Download https://github.com/google/glog/archive/v0.3.5.tar.gz

> Task :react-native-reanimated:downloadFolly
Download https://github.com/facebook/folly/archive/v2021.07.22.00.tar.gz

> Task :react-native-reanimated:configureCMakeDebug[arm64-v8a] FAILED

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

Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.    
Please consult deprecation warnings for more details.
258 actionable tasks: 47 executed, 211 up-to-date
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.        

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-reanimated:configureCMakeDebug[arm64-v8a]'.
> [CXX1405] exception while building Json A problem occurred starting process 'command 'C:\Users\marimuthu.b\AppData\Local\Android\Sdk\cmake\3.18.1\bin\cmake.exe''

* 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

BUILD FAILED in 19m 3s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=3000
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.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-reanimated:configureCMakeDebug[arm64-v8a]'.
> [CXX1405] exception while building Json A problem occurred starting process 'command 'C:\Users\marimuthu.b\AppData\Local\Android\Sdk\cmake\3.18.1\bin\cmake.exe''

* 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

BUILD FAILED in 19m 3s

    at makeError (sample\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
    at sample\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (sample\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (sample\node_modules\@react-native-community\cli\build\index.js:142:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Steps to reproduce

install the package and build the app.. it fails

"react-native-reanimated": "^2.10.0", "react-native-reanimated-carousel": "^3.0.5", "react-native-paper": "^4.12.4", "react-native": "^0.70.0", "react": "18.1.0", "react-native-gesture-handler": "^2.6.0",

Snack or a link to a repository

https://github.com/software-mansion/react-native-reanimated

Reanimated version

2.10.0

React Native version

0.70.0

Platforms

Android, iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

Android emulator

Device model

No response

Acknowledgements

Yes

Maribhuvan avatar Sep 20 '22 14:09 Maribhuvan

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

github-actions[bot] avatar Sep 20 '22 14:09 github-actions[bot]

Hey, the title of the PR contains "new architecture" but you selected "Paper (Old Architecture)". Do you have Fabric enabled in your app? Can you make sure that C:\Users\marimuthu.b\AppData\Local\Android\Sdk\cmake\3.18.1\bin\cmake.exe exists and Gradle can execute it?

tomekzaw avatar Sep 21 '22 07:09 tomekzaw

Same issue

sonipranjal avatar Oct 01 '22 22:10 sonipranjal

alguma solução pra esse erro?

wlyntx avatar Oct 06 '22 13:10 wlyntx

same issue rn 0.70.3 , "react-native-reanimated": "^2.10.0",

-- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done

CMake Error at CMakeLists.txt:74 (add_library): Cannot find source file:

  /Users/legit-group/Documents/Works/Legit/fe/x-food-app/node_modules/react-native-reanimated/Common/cpp/Fabric/FabricUtils.cpp

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx

CMake Error at CMakeLists.txt:74 (add_library): No SOURCES given to target: reanimated

ajiehatajie avatar Oct 14 '22 22:10 ajiehatajie

Hey @ajiehatajie, why do you think it's "same issue"?

The error from issue description is:

> [CXX1405] exception while building Json A problem occurred starting process 'command 'C:\Users\marimuthu.b\AppData\Local\Android\Sdk\cmake\3.18.1\bin\cmake.exe''

The error from your comment is:

Cannot find source file:
  /Users/legit-group/Documents/Works/Legit/fe/x-food-app/node_modules/react-native-reanimated/Common/cpp/Fabric/FabricUtils.cpp

tomekzaw avatar Oct 15 '22 08:10 tomekzaw

Same issue here. Removing "react-native-reanimated" and leaving "react-native-gesture-handler" allows me to run the app using the new arch, but this is not a final solution because I definitely need reanimated.

Edit: I was able to run the app using: "react-native-reanimated": "^3.0.0-rc.3"

fgagneten avatar Oct 15 '22 16:10 fgagneten

This issue is valid and not even related to re-downloading. Now it's related to the deprecation of jcenter. Which is much worse. I temporarily fixed the issue by hacking it just to keep building. But it must definitely have to be fixed. Because my hack won't work on CI unless I fork the lib. Which I don't want at all. Here snippet, change in build.gradle of lib:

Line:659 at 3.0.0-rc.4

task downloadBoost(dependsOn: resolveBoost, type: Download) {
+   acceptAnyCertificate true
    def transformedVersion = BOOST_VERSION.replace("_", ".")
    def artifactLocalName = "boost_${BOOST_VERSION}.tar.gz"
    def srcUrl = "https://boostorg.jfrog.io/artifactory/main/release/${transformedVersion}/source/boost_${BOOST_VERSION}.tar.gz"
    if (REACT_NATIVE_MINOR_VERSION < 69) {
        srcUrl = "https://github.com/react-native-community/boost-for-react-native/releases/download/v${transformedVersion}-0/boost_${BOOST_VERSION}.tar.gz"
    }
    src(srcUrl)
    onlyIfNewer(true)
    overwrite(false)
    dest(new File(downloadsDir, artifactLocalName))
}

Update

Appearantly my solution below was unrelated and were tail of something else and I fixed my problem with adding following lines in to my main build.gradle's repositories part;

allprojects {
    repositories {
            // We get React Native's Android binaries exclusively through npm,
            // from a local Maven repo inside node_modules/react-native/.
            // (The use of exclusiveContent prevents looking elsewhere like Maven Central
            // and potentially getting a wrong version.)
            filter {
                includeGroup "com.facebook.react"
            }
            forRepository {
                maven {
                    url "$rootDir/../node_modules/react-native/android"
                }
            }
        }
        // ...rest
    }
    // ...rest
}

yadigarbz avatar Nov 08 '22 09:11 yadigarbz

I got the same error while setting up my project in new Mac m1 . I am working with old arch. Is there any solution for old arch ?

Error -

`What went wrong: Execution failed for task ':react-native-mmkv-storage:configureCMakeDebug[arm64-v8a]'.

[CXX1405] exception while building Json A problem occurred starting process 'command '/Users/team/Library/Android/sdk/cmake/3.18.1/bin/cmake''`

deepanshu770 avatar Nov 10 '22 09:11 deepanshu770

I manually installed NDK and cmake throw Android studio so that error was came. Now I'm remove NDK and cmake from Android studio then run "npm run android" it automatically download cmake and ndk and it's working

Maribhuvan avatar Nov 11 '22 03:11 Maribhuvan

I got the same error while setting up my project in new Mac m1 . I am working with old arch. Is there any solution for old arch ?

Error -

`What went wrong: Execution failed for task ':react-native-mmkv-storage:configureCMakeDebug[arm64-v8a]'.

[CXX1405] exception while building Json A problem occurred starting process 'command '/Users/team/Library/Android/sdk/cmake/3.18.1/bin/cmake''`

I ran

softwareupdate --install-rosetta

It works for me

royarnaudb avatar Nov 17 '22 15:11 royarnaudb

Same issue here. Removing "react-native-reanimated" and leaving "react-native-gesture-handler" allows me to run the app using the new arch, but this is not a final solution because I definitely need reanimated.

Edit: I was able to run the app using: "react-native-reanimated": "^3.0.0-rc.3"

build is getting created with this change.

sudhanshusirohia avatar Jan 22 '23 08:01 sudhanshusirohia