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

Can not build Android with react-native version 0.72.0

Open AllmaG3st opened this issue 1 year ago • 33 comments

Description

After installing Reanimated 3 (versions 3.0.0 and 3.3.0 were tried) android app does not build any more. Attempt to build the app from VS code just stuck on info JS server already running.

Attempt to build from Android Studio gives this at first Configure project :react-native-reanimated No AAR for react-native-reanimated found. Attempting to build from source.

and then error: [CXX1101] NDK at /Users/'user'/Library/Android/sdk/ndk/23.1.7779620 did not have a source.properties file

Steps to reproduce

  1. Create React Native Project with npx init (version 0.72.0)
  2. Install react-native-reanimated following the instruction (version 3.0.0 or 3.3.0)
  3. Try to build on Android.

Snack or a link to a repository

https://github.com/AllmaG3st/RN-Weather-Quest

Reanimated version

3.0.0

React Native version

0.72.0

Platforms

Android

JavaScript runtime

None

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

Real device

Device model

Any

Acknowledgements

Yes

AllmaG3st avatar Jul 12 '23 07:07 AllmaG3st

I have had the same issue. Try to clean gradlew (cd android && call gradlew clean && ./gradlew cleanBuildCache && cd ..) Also, rm node_modules and npm i just in case... & use the reanimated 3.3.0

It worked on my app, but I had other issues with 3rd party libs so I decided to stay on 0.71.

giannismanie avatar Jul 12 '23 07:07 giannismanie

still the same

vincemavill avatar Jul 12 '23 08:07 vincemavill

can you try with ndk 24.0.8215888?

efstathiosntonas avatar Jul 12 '23 08:07 efstathiosntonas

@efstathiosntonas not working sir, IOS is fine but Android not. this is the error message react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp.o cannot be safely placed under this directory. The build may not work correctly. ninja: error: manifest 'build.ninja' still dirty after 100 tries

vincemavill avatar Jul 12 '23 08:07 vincemavill

ok so the error changed to this now? Is this a real path on your mac: /Users/'user'/Library maybe the problem is that user has quotes.

edit: https://visualgdb.com/documentation/cmake/CMAKE_OBJECT_PATH_MAX/

efstathiosntonas avatar Jul 12 '23 08:07 efstathiosntonas

ok so the error changed to this now? Is this a real path on your mac: /Users/'user'/Library maybe the problem is that user has quotes.

edit: https://visualgdb.com/documentation/cmake/CMAKE_OBJECT_PATH_MAX/

I just changed my username, and quoted 'user' :D

AllmaG3st avatar Jul 12 '23 08:07 AllmaG3st

So, I think I found out the reason, I started completely new project with updated Node version, previously I was using 16.20.0, I upgraded to 18.16.0 and now it works.

AllmaG3st avatar Jul 12 '23 08:07 AllmaG3st

mine is still not working on Android I am using RN 0.72 and reanimated 3.3.0

vincemavill avatar Jul 12 '23 09:07 vincemavill

mine is still not working on Android I am using RN 0.72 and reanimated 3.3.0

is it 0.72.0 or 0.72.1?

AllmaG3st avatar Jul 12 '23 10:07 AllmaG3st

@AllmaG3st 0.72.0 sir,

vincemavill avatar Jul 12 '23 10:07 vincemavill

Also not working for me with error - RN 0.72.3 RNR 3.3 It does work locally for me but not from our CI machine for android.

hermeseEnabled=true/false newArchEnabled=false

buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 kotlinVersion = "1.8.20" ndkVersion = "23.1.7779620"

Execution failed for task ':react-native-reanimated:configureCMakeRelWithDebInfo[arm64-v8a]'. @kmagiera @piaskowyk @tomekzaw

TylerJackson avatar Jul 14 '23 14:07 TylerJackson

Also an error, but another one.

Task :react-native-reanimated:buildCMakeDebug[armeabi-v7a] FAILED ninja: error: manifest 'build.ninja' still dirty after 100 tries

RN 0.72.3 RNR 3.3.0 (New project) buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 ndkVersion = "23.1.7779620"

Update: Tried some other versions of RNR with RN 0.72.3 Until 2.17.0 it is working, as of 3.0.0 it goes wrong.

Update: I was able to get RNR 3.3.0 working with RN 0.72.3 by removing armeabi-v7a from reactNativeArchitectures in android/gradle.properties

CoonHouse avatar Jul 15 '23 18:07 CoonHouse

* What went wrong: Execution failed for task ':react-native-reanimated:buildCMakeDebug[arm64-v8a]'. Unable to delete file 'C:\Users\Artem\Documents\flashcardseng\node_modules\react-native-reanimated\android\build\intermediates\cxx\Debug\1o6v2eo5\obj\ar m64-v8a'

I swear, someday I'll throw this React Native into the trash bin with all its endless errors in Reanimated.

lekbit avatar Jul 18 '23 20:07 lekbit

I will describe all the steps I took to make it work, but I can't say for sure which of them was actually necessary. Firstly, I recreated the project from scratch. 1)npx react-native init AwesomeProject --version 0.72.1 2)add string kotlinVersion = '1.8.10' to "android/build.gradle" 3)Then I immediately installed "reanimated", "gesture-handler" 4)delete the "node_modules" folder 5)Open "VS code" as administrator. 6)npm install 7)npx react-native run-android Also note my NDK version in "Android studio" is 23.1.77

lekbit avatar Jul 20 '23 20:07 lekbit

@TylerJackson please refer this comment

Remove _JAVA_OPTIONS in cimg/android on circleci and it works now

Dat-Mobile avatar Jul 21 '23 08:07 Dat-Mobile

Finally build successfully 👍

image

here are some changes I have made: Packages & dependencies "@react-navigation/drawer": "^6.6.3", "@react-navigation/native": "^6.1.7", "react": "18.2.0", "react-native": "0.72.1", "react-native-gesture-handler": "^2.12.0", "react-native-reanimated": "^3.4.0", "react-native-safe-area-context": "^4.7.1", "react-native-screens": "^3.23.0"

steps:

  1. uninstall "react-native-reanimated" and then install this version of RNR 3.4.0
  2. Installed ndk version "23.1.7779620"
  3. added ndk path in local.properties file under android like below ndk.dir=C:\Users\kashif\AppData\Local\Android\sdk\ndk\23.1.7779620
  • move project to main drive like D: because RNR CMAKE PATH characters should be less than 250.

EXCEPTIONAL Chcange

minSdkVersion from 21 to 23 as i was using status bar so that requires min SDK v=23

Build succeeded. 💯

revealer409 avatar Jul 27 '23 05:07 revealer409

Finally build successfully +1

image

here are some changes I have made: Packages & dependencies "@react-navigation/drawer": "^6.6.3", "@react-navigation/native": "^6.1.7", "react": "18.2.0", "react-native": "0.72.1", "react-native-gesture-handler": "^2.12.0", "react-native-reanimated": "^3.4.0", "react-native-safe-area-context": "^4.7.1", "react-native-screens": "^3.23.0"

steps:

  1. uninstall "react-native-reanimated" and then install this version of RNR 3.4.0
  2. Installed ndk version "23.1.7779620"
  3. added ndk path in local.properties file under android like below ndk.dir=C:\Users\kashif\AppData\Local\Android\sdk\ndk\23.1.7779620
  • move project to main drive like D: because RNR CMAKE PATH characters should be less than 250.

EXCEPTIONAL Chcange

minSdkVersion from 21 to 23 as i was using status bar so that requires min SDK v=23

Build succeeded. 100

I followed these steps on my linux pc. Didn't work for the first time but after doing this and also unset _JAVA_OPTIONS and it worked for me.

mog-rn avatar Jul 30 '23 20:07 mog-rn

+1 facing same issue

manage-some avatar Aug 01 '23 16:08 manage-some

Uninstalling and reinstalling the NDK (23.1.7779620 in my build.gradle), as described here, fixed the error for me.

blwinters avatar Aug 12 '23 17:08 blwinters

Uninstalling and reinstalling the NDK (23.1.7779620 in my build.gradle), as described here, fixed the error for me.

I tried that severally and it did't work for me

mog-rn avatar Aug 13 '23 17:08 mog-rn

Uninstalling and reinstalling the NDK (23.1.7779620 in my build.gradle), as described here, fixed the error for me.

I tried that severally and it did't work for me

Didn't worked for me either. It was working fine with RN 0.71.8

diegodorado avatar Aug 24 '23 14:08 diegodorado

In my case I'm trying to use react-navigation and when I run npx react-native start it shows an error about reanimated and the message:

[CXX1101] NDK at /Users/'user'/Library/Android/sdk/ndk/23.1.7779620 did not have a source.properties file

To solve this, I opened my Android Studio > More Actions > SDK Manager > Languages & Frameworks > Android SDK > SDK Tools and I selected the NDK version 24.0.8215888 and unchecked other versions. Then Apply and ran the react-native project again. It works!

MateusPitura avatar Oct 28 '23 17:10 MateusPitura

I also recommend using the SDK Manager to download the corresponding NDK. You can see its version when you run ./gradlew clean from the "android" folder. Otherwise we don't know if the run android process is blocked or not.

rmarquois avatar Nov 14 '23 10:11 rmarquois

i am new to react-native and i am getting this same problem

what should i do? i tried different things but nothing worked any tip

edit: "react-native-reanimated": "^2.17.0" is working for me

soransh-singh avatar Feb 16 '24 12:02 soransh-singh

cd to the mentioned ndk directory /Users/'user'/Library/Android/sdk/ndk/23.1.7779620 and then delete it using rm -rf 23.1.7779620

byteab avatar Feb 28 '24 05:02 byteab

Also an error, but another one.

Task :react-native-reanimated:buildCMakeDebug[armeabi-v7a] FAILED ninja: error: manifest 'build.ninja' still dirty after 100 tries

RN 0.72.3 RNR 3.3.0 (New project) buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 ndkVersion = "23.1.7779620"

Update: Tried some other versions of RNR with RN 0.72.3 Until 2.17.0 it is working, as of 3.0.0 it goes wrong.

Update: I was able to get RNR 3.3.0 working with RN 0.72.3 by removing armeabi-v7a from reactNativeArchitectures in android/gradle.properties

@CoonHouse you literally saved my project, thank you

analuizaalvesm avatar Mar 28 '24 16:03 analuizaalvesm

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':react-native-screens'.

[CXX1101] NDK at C:\Users\sanju\AppData\Local\Android\Sdk\ndk\25.1.8937393 did not have a source.properties file I am having this error someone please help

Sanjeev12357 avatar Apr 10 '24 18:04 Sanjeev12357

I have the same issue with react native verion 0.74.0

gustavosantaella avatar May 02 '24 17:05 gustavosantaella

I have the same issue with react native verion 0.74.0

I have resolved the issue you need to delete the sdk/ndk/25.1.8937 and bundle the app again

Sanjeev12357 avatar May 02 '24 18:05 Sanjeev12357

I have the same issue with react native verion 0.74.0

I have resolved the issue you need to delete the sdk/ndk/25.1.8937 and bundle the app again

Could you please describe it in more detail. I am also facing same issue

Pratik-2102 avatar May 03 '24 07:05 Pratik-2102