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.

Cannot build an app when using Reanimated and V8

See original GitHub issue

Description

When I try to use reanimated 2 with react-native-v8, gradle sync in Android Studio fails with the following error:

Starting Gradle Daemon...
Gradle Daemon started in 1 s 373 ms
> Task :react-native-gradle-plugin:compileKotlin UP-TO-DATE
> Task :react-native-gradle-plugin:compileJava NO-SOURCE
> Task :react-native-gradle-plugin:pluginDescriptors UP-TO-DATE
> Task :react-native-gradle-plugin:processResources UP-TO-DATE
> Task :react-native-gradle-plugin:classes UP-TO-DATE
> Task :react-native-gradle-plugin:inspectClassesForKotlinIC UP-TO-DATE
> Task :react-native-gradle-plugin:jar UP-TO-DATE

> Configure project :react-native-reanimated
Native libs debug enabled: false
Android gradle plugin: 7.2.1
Gradle: 7.5.1
building Reanimated2

> Task :prepareKotlinBuildScriptModel UP-TO-DATE
C/C++: debug|x86 :CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
C/C++: debug|x86 :Please set them or make sure they are set and tested correctly in the CMake files:
C/C++: debug|x86 :V8EXECUTOR_LIB
C/C++: debug|x86 :    linked by target "reanimated" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-reanimated/android
C/C++: debug|x86 :CMake Generate step failed.  Build files cannot be regenerated correctly.
[CXX1405] error when building with cmake using /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-reanimated/android/CMakeLists.txt: Build command failed.
Error while executing process /Users/lukasz.kinasiewicz/Library/Android/sdk/cmake/3.18.1/bin/cmake with arguments {-H/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-reanimated/android -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=21 -DANDROID_PLATFORM=android-21 -DANDROID_ABI=x86 -DCMAKE_ANDROID_ARCH_ABI=x86 -DANDROID_NDK=/Users/lukasz.kinasiewicz/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_ANDROID_NDK=/Users/lukasz.kinasiewicz/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_TOOLCHAIN_FILE=/Users/lukasz.kinasiewicz/Library/Android/sdk/ndk/21.4.7075529/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/Users/lukasz.kinasiewicz/Library/Android/sdk/cmake/3.18.1/bin/ninja -DCMAKE_CXX_FLAGS=-fstack-protector-all -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-reanimated/android/build/intermediates/cxx/Debug/591x5v3h/obj/x86 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-reanimated/android/build/intermediates/cxx/Debug/591x5v3h/obj/x86 -DCMAKE_BUILD_TYPE=Debug -B/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-reanimated/android/.cxx/Debug/591x5v3h/x86 -GNinja -DANDROID_STL=c++_shared -DNATIVE_DEBUG=false -DREACT_NATIVE_TARGET_VERSION=70 -DANDROID_TOOLCHAIN=clang -DBOOST_VERSION=1_76_0 -DNODE_MODULES_DIR=/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules -DJS_RUNTIME=v8 -DJS_RUNTIME_DIR=/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8 -DCLIENT_SIDE_BUILD=true -DIS_NEW_ARCHITECTURE_ENABLED=false -DPLAYGROUND_APP_NAME=reanimatedApp -DRNVERSION=70}
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/lukasz.kinasiewicz/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - 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: /Users/lukasz.kinasiewicz/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
V8EXECUTOR_LIB
    linked by target "reanimated" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-reanimated/android

CMake Generate step failed.  Build files cannot be regenerated correctly.

C/C++: debug|x86 :CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
C/C++: debug|x86 :Please set them or make sure they are set and tested correctly in the CMake files:
C/C++: debug|x86 :FBJNI_LIB
C/C++: debug|x86 :    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
C/C++: debug|x86 :FOLLY_LIB
C/C++: debug|x86 :    linked by target "reactnative_internal_static" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
C/C++: debug|x86 :    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
C/C++: debug|x86 :GLOG_LIB
C/C++: debug|x86 :    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
C/C++: debug|x86 :JSINSPECTOR_LIB
C/C++: debug|x86 :    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
C/C++: debug|x86 :JSI_LIB
C/C++: debug|x86 :    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
C/C++: debug|x86 :REACT_NATIVE_JNI_LIB
C/C++: debug|x86 :    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
C/C++: debug|x86 :V8_ANDROID_LIB
C/C++: debug|x86 :    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
C/C++: debug|x86 :CMake Generate step failed.  Build files cannot be regenerated correctly.
[CXX1405] error when building with cmake using /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android/CMakeLists.txt: Build command failed.
Error while executing process /Users/lukasz.kinasiewicz/Library/Android/sdk/cmake/3.18.1/bin/cmake with arguments {-H/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=21 -DANDROID_PLATFORM=android-21 -DANDROID_ABI=x86 -DCMAKE_ANDROID_ARCH_ABI=x86 -DANDROID_NDK=/Users/lukasz.kinasiewicz/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_ANDROID_NDK=/Users/lukasz.kinasiewicz/Library/Android/sdk/ndk/21.4.7075529 -DCMAKE_TOOLCHAIN_FILE=/Users/lukasz.kinasiewicz/Library/Android/sdk/ndk/21.4.7075529/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/Users/lukasz.kinasiewicz/Library/Android/sdk/cmake/3.18.1/bin/ninja -DCMAKE_CXX_FLAGS=-fstack-protector-all -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android/build/intermediates/cxx/Debug/195v332w/obj/x86 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android/build/intermediates/cxx/Debug/195v332w/obj/x86 -DCMAKE_BUILD_TYPE=Debug -B/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android/.cxx/Debug/195v332w/x86 -GNinja -DANDROID_STL=c++_shared -DBOOST_VERSION=1_76_0 -DBUILD_DIR=/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android/build -DRN_DIR=/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native -DREACT_NATIVE_TARGET_VERSION=70 -DV8_ANDROID_DIR=/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/v8-android-jit -DSO_DIR=/Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android/build/jniLibs}
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/lukasz.kinasiewicz/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - 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: /Users/lukasz.kinasiewicz/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
FBJNI_LIB
    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
FOLLY_LIB
    linked by target "reactnative_internal_static" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
GLOG_LIB
    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
JSINSPECTOR_LIB
    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
JSI_LIB
    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
REACT_NATIVE_JNI_LIB
    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android
V8_ANDROID_LIB
    linked by target "v8executor" in directory /Users/lukasz.kinasiewicz/dev/reanimatedApp/node_modules/react-native-v8/android

CMake Generate step failed.  Build files cannot be regenerated correctly.


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 SUCCESSFUL in 28s
5 actionable tasks: 5 up-to-date

Steps to reproduce

  1. Clone the linked repo
  2. yarn
  3. yarn start
  4. Open android directory in Android Studio
  5. In Android Studio run Sync project with gradle files - it logs the error mentioned above
  6. In Android Studio run Run app - the application throws an exception due to missing libv8android.so.

Notes:

  1. If I run yarn android the app builds and works properly.
  2. Android Studio version is 2021.2.1 Patch 1

Snack or a link to a repository

https://github.com/lkinasiewicz/reanimatedApp

Reanimated version

2.10.0

React Native version

0.70.0

Platforms

Android

JavaScript runtime

V8

Workflow

No response

Architecture

No response

Build type

No response

Device

No response

Device model

No response

Acknowledgements

Yes

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
shamilovtimcommented, Sep 14, 2022

Thought I’d drop some data to help everyone out. We use both react-native-reanimated@2.10.0 and react-native-v8@1.4.7 successfully in our project. We have never received any of the errors mentioned.

Here are our versions:

Android Gradle Plugin is 7.0.4
Gradle is 7.3.3
React Native is 0.68.3
Expo (bare) is 45.0.8

buildToolsVersion = "31.0.0"
minSdkVersion = 24
compileSdkVersion = 31
targetSdkVersion = 31
androidxLibVersion = "1.8.0"

In app/build.gradle make sure you have:

project.ext.reanimated = [
        buildFromSource: true
]

Thank you to the authors of both of these plugins. Since the official support landed last month both reanimated and v8 have been working together flawlessly for us at Shipt.

3reactions
RemarkableMcommented, Sep 14, 2022

I got the same issue as well. For now I just downgraded to 2.9.1, but looking for a solution for 2.10

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging worklets | React Native Reanimated - Open Source
These are the debugging tools we checked for compatibility with React Native apps using the Reanimated library: Chrome debugger (also known as the...
Read more >
Using Hermes Engine - Expo Documentation
One of the many limitations of remote debugging is that it does not work with modules built on top of JSI. For example,...
Read more >
task :react-native-reanimated:downloadboost failed - You.com
I cannot build my app for Android (iOS works perfectly) in a yarn monorepo project. When I run yarn run android , I...
Read more >
Does anyone use flipper mainly to debug? : r/reactnative
Yeah my app's interactions are built around reanimated, so I can't even „just disable it“ to debug. It sucks.
Read more >
react-native-reanimated - npm
Start using react-native-reanimated in your project by running `npm i ... TypeScript icon, indicating that this package has built-in type ...
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