facebook / react-native

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

Failed to transform react-native-reanimated-65-jsc.aar #32037

Closed SectionTN closed 2 years ago

SectionTN commented 3 years ago

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

BUILD FAILED in 19s

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=8081

React Native version:

System: OS: Windows 10 10.0.19042 CPU: (4) x64 Intel(R) Core(TM) i5-4288U CPU @ 2.60GHz Memory: 3.13 GB / 9.94 GB Binaries: Node: 14.17.5 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD npm: 6.14.14 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: API Levels: 30, 31 Build Tools: 30.0.2, 30.0.3, 31.0.0 Android NDK: Not Found Windows SDK: AllowAllTrustedApps: Enabled IDEs: Android Studio: Not Found Visual Studio: Not Found Languages: Java: 11.0.12 - C:\Program Files\Eclipse Foundation\jdk-11.0.12.7-hotspot\bin\javac.EXE npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.65.0 => 0.65.0 react-native-windows: Not Found npmGlobalPackages: react-native: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

i dunno

Expected Results

i got a build error from gradle

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

https://stackoverflow.com/questions/68831714/failed-to-transform-react-native-reanimated-65-jsc-aar

SkySails commented 3 years ago

Have you tried using the latest version of react-native-reanimated? I believe that it is up to them to support new versions of React Native.

This issue seems to suggest that versions above v2.3.0 (still in alpha) should work.

gabrielbezerra81 commented 3 years ago

As mentioned above, react-native-reanimated still need to support RN 0.65. You can make it work with reanimated 2.3.0-alpha.2 version or wait 2.3 to be stable.

SectionTN commented 3 years ago

new NativeEventEmitter() was called with a non-null argument without the required addListener method. new NativeEventEmitter() was called with a non-null argument without the required removeListeners method. new NativeEventEmitter() was called with a non-null argument without the required addListener method.

and it says that a variable named "shouldUseWeb' and an Appregistry error

those shows in the console even i have reanimated or not in my package.json

tapz commented 3 years ago

With Reanimated alpha.2, all RN 0.65.0 changes (upgrade-helper), all npm and gradle/maven dependencies, plugins etc updated to the latest versions, the app does not crash, but I get the following yellow box warnings:

`new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method.
`new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method.

EventEmitter.removeListener('appStateDidChange', ...): Method has been deprecated. Please instead use `remove()` on the subscription returned by `EventEmitter.addListener`.
SectionTN commented 3 years ago

@tapz same here but i got an AppRegistery error after those yellow warnings

cw-dos commented 3 years ago

I also resolved this issue with: react-native-reanimated 2.3.0-alpha.2

Update: This did not work, the app will build, but when I try to run it, it fails, same error messages everyone else is reporting.

wincod75 commented 3 years ago

@tapz same here but i got an AppRegistery error after those yellow warnings

Were you able to resolve this? I thought I had fixed the issue with 2.3.0-alpha.2, but i'm getting the exact same warnings you mentioned in this thread, Android only, iOS is fine, thoughts?

AlphaJuliettOmega commented 3 years ago

@wincod75

With Reanimated alpha.2, all RN 0.65.0 changes (upgrade-helper), all npm and gradle/maven dependencies, plugins etc updated to the latest versions, the app does not crash, but I get the following yellow box warnings:

`new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method.
`new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method.

EventEmitter.removeListener('appStateDidChange', ...): Method has been deprecated. Please instead use `remove()` on the subscription returned by `EventEmitter.addListener`.

So you haven't seen the shouldBeUseWeb error on RN 0.65.1 + react-native-reanimated 2.3.0-alpha.2?

tapz commented 3 years ago

@AlphaJuliettOmega I have never seen shouldBeUseWeb.

AlphaJuliettOmega commented 3 years ago

@tapz on my dev build, the RN 0.65.1 update + the reanimated Alpha 2 causes a 'function is undefined' error for shouldBeUseWeb. It is not a function I use in my application, and my app is only for mobile platforms (ie. not Web)

It's something to do with the Platform-checker dependency that seems recently added.

I stashed the .64 -> .65.1 migration for now (which I want to do with a reanimated update), the speed improvements seem real in our application at first glance but I do not want to introduce any instability.

Edit: It's fixed, pending release. Apologies for the noise. Will try again with Alpha 3 https://github.com/software-mansion/react-native-reanimated/issues/2314#issuecomment-905495360

wincod75 commented 3 years ago

@wincod75

With Reanimated alpha.2, all RN 0.65.0 changes (upgrade-helper), all npm and gradle/maven dependencies, plugins etc updated to the latest versions, the app does not crash, but I get the following yellow box warnings:

`new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method.
`new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method.

EventEmitter.removeListener('appStateDidChange', ...): Method has been deprecated. Please instead use `remove()` on the subscription returned by `EventEmitter.addListener`.

So you haven't seen the shouldBeUseWeb error on RN 0.65.1 + react-native-reanimated 2.3.0-alpha.2?

Sorry for the late reply, yes I was seeing shouldBeUseWeb

kvicera commented 3 years ago

Hello, for anyone who is experiencing this error while trying to use react-navigation, here's how I fixed mine.

  1. First, install react-navigation npm install @react-navigation/native
  2. Install dependencies npm install react-native-reanimated@2.3.0-alpha.2 react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
  3. Follow the setup for react-native-reanimated https://docs.swmansion.com/react-native-reanimated/docs/installation/#babel-plugin
  4. Follow the setup guide for react-navigation(skip npm installation since it is already done in step 2) https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project
  5. Close all terminals and rebuild.

Here is my configuration; @react-navigation/native": "^6.0.2", react": "17.0.2", react-native": "0.65.1", react-native-gesture-handler": "^1.10.3", react-native-reanimated": "^2.3.0-alpha.2", react-native-safe-area-context": "^3.3.0", react-native-screens": "^3.6.0"

I am running this on an actual Android device.

The warnings mentioned by @tapz and @CortexTN is not present in my current config. In fact, no warning is coming out from my terminal. I would be glad if anyone can confirm. EDIT: I now have the warning when I used react-navigation/drawer, but it works just fine(for now). WARN new NativeEventEmitter() was called with a non-null argument without the required addListener method. WARN new NativeEventEmitter() was called with a non-null argument without the required removeListeners method.

I think the guide in https://reactnavigation.org/docs/getting-started for 6.x.x is missing two dependencies (react-native-reanimated, react-native-gesture-handler).

wincod75 commented 3 years ago

Unfortunately I ended up downgrading my RN version and rolling back this package to V 2...

odanicola commented 3 years ago

@wincod75 which version you downgraded your RN version

wincod75 commented 3 years ago

@wincod75 which version you downgraded your RN version

What lead me here was build issues in Android with "react-native": "0.64.2", so after going round in circles I finally decided to just back up RN to 64.1 and magically all is well in the world... for now.

"react": "17.0.1",
"react-native": "0.64.1",
camilo86 commented 3 years ago

Hello, for anyone who is experiencing this error while trying to use react-navigation, here's how I fixed mine.

  1. First, install react-navigation npm install @react-navigation/native
  2. Install dependencies npm install react-native-reanimated@2.3.0-alpha.2 react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
  3. Follow the setup for react-native-reanimated https://docs.swmansion.com/react-native-reanimated/docs/installation/#babel-plugin
  4. Follow the setup guide for react-navigation(skip npm installation since it is already done in step 2) https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project
  5. Close all terminals and rebuild.

Here is my configuration; @react-navigation/native": "^6.0.2", react": "17.0.2", react-native": "0.65.1", react-native-gesture-handler": "^1.10.3", react-native-reanimated": "^2.3.0-alpha.2", react-native-safe-area-context": "^3.3.0", react-native-screens": "^3.6.0"

I am running this on an actual Android device.

The warnings mentioned by @tapz and @CortexTN is not present in my current config. In fact, no warning is coming out from my terminal. I would be glad if anyone can confirm. EDIT: I now have the warning when I used react-navigation/drawer, but it works just fine(for now). WARN new NativeEventEmitter() was called with a non-null argument without the required addListener method. WARN new NativeEventEmitter() was called with a non-null argument without the required removeListeners method.

I think the guide in https://reactnavigation.org/docs/getting-started for 6.x.x is missing two dependencies (react-native-reanimated, react-native-gesture-handler).

These steps worked for me. Thanks!

sleaper commented 3 years ago

Hello, for anyone who is experiencing this error while trying to use react-navigation, here's how I fixed mine.

  1. First, install react-navigation npm install @react-navigation/native
  2. Install dependencies npm install react-native-reanimated@2.3.0-alpha.2 react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
  3. Follow the setup for react-native-reanimated https://docs.swmansion.com/react-native-reanimated/docs/installation/#babel-plugin
  4. Follow the setup guide for react-navigation(skip npm installation since it is already done in step 2) https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project
  5. Close all terminals and rebuild.

Here is my configuration; @react-navigation/native": "^6.0.2", react": "17.0.2", react-native": "0.65.1", react-native-gesture-handler": "^1.10.3", react-native-reanimated": "^2.3.0-alpha.2", react-native-safe-area-context": "^3.3.0", react-native-screens": "^3.6.0"

I am running this on an actual Android device.

The warnings mentioned by @tapz and @CortexTN is not present in my current config. In fact, no warning is coming out from my terminal. I would be glad if anyone can confirm. EDIT: I now have the warning when I used react-navigation/drawer, but it works just fine(for now). WARN new NativeEventEmitter() was called with a non-null argument without the required addListener method. WARN new NativeEventEmitter() was called with a non-null argument without the required removeListeners method.

I think the guide in https://reactnavigation.org/docs/getting-started for 6.x.x is missing two dependencies (react-native-reanimated, react-native-gesture-handler).

This didint work for me. Does anyone have any more advices or do I have to downgrade RN?

SectionTN commented 3 years ago

Hello, for anyone who is experiencing this error while trying to use react-navigation, here's how I fixed mine.

  1. First, install react-navigation npm install @react-navigation/native
  2. Install dependencies npm install react-native-reanimated@2.3.0-alpha.2 react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
  3. Follow the setup for react-native-reanimated https://docs.swmansion.com/react-native-reanimated/docs/installation/#babel-plugin
  4. Follow the setup guide for react-navigation(skip npm installation since it is already done in step 2) https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project
  5. Close all terminals and rebuild.

Here is my configuration; @react-navigation/native": "^6.0.2", react": "17.0.2", react-native": "0.65.1", react-native-gesture-handler": "^1.10.3", react-native-reanimated": "^2.3.0-alpha.2", react-native-safe-area-context": "^3.3.0", react-native-screens": "^3.6.0"

I am running this on an actual Android device.

The warnings mentioned by @tapz and @CortexTN is not present in my current config. In fact, no warning is coming out from my terminal. I would be glad if anyone can confirm. EDIT: I now have the warning when I used react-navigation/drawer, but it works just fine(for now). WARN new NativeEventEmitter() was called with a non-null argument without the required addListener method. WARN new NativeEventEmitter() was called with a non-null argument without the required removeListeners method.

I think the guide in https://reactnavigation.org/docs/getting-started for 6.x.x is missing two dependencies (react-native-reanimated, react-native-gesture-handler).

This didint work for me. Does anyone have any more advices or do I have to downgrade RN?

the better choice is to downgrade RN imo, and wait for some kinda stable release of reanimated and other libraries

odanicola commented 3 years ago

@wincod75 I came up with upgrading react native & react navigation into their latest versions, then I removed react native animated as react navigation 6 only has two dependencies (react-native-safe-area-context & react-native-screens).

My react native project was 62.2 then due to repository replacement of jcenter to maven, I need to upgrade it, but the warning above showed, then I decided to upgrade all the packages one by one. Then the warning just disappeared when I upgraded firebase/app, firebase/messaging & firebase/analytics.

I don't know if this will help you or not, but on my console, I see no longer the warning.

wincod75 commented 3 years ago

@wincod75 I came up with upgrading react native & react navigation into their latest versions, then I removed react native animated as react navigation 6 only has two dependencies (react-native-safe-area-context & react-native-screens).

My react native project was 62.2 then due to repository replacement of jcenter to maven, I need to upgrade it, but the warning above showed, then I decided to upgrade all the packages one by one. Then the warning just disappeared when I upgraded firebase/app, firebase/messaging & firebase/analytics.

I don't know if this will help you or not, but on my console, I see no longer the warning.

Thanks for the tip; i'll give this a try for my next release.

matheusfaggi commented 3 years ago

react-reanimated release a new version to support react-native 0.65.

Release 2.2.1

kvicera commented 3 years ago

react-reanimated release a new version to support react-native 0.65.

Release 2.2.1

upgraded to 2.2.1 and all is good! the warnings are also gone.

trubnikovr commented 3 years ago

still the same error

adelalmaleh2 commented 3 years ago

None of these solutions works, I'm going to downgrade RN..

byteab commented 2 years ago

if you are using "react-native": "0.66" then use this version of reanimated "react-native-reanimated": "^2.3.0-beta.2"

adelalmaleh2 commented 2 years ago

if you are using "react-native": "0.66" then use this version of reanimated "react-native-reanimated": "^2.3.0-beta.2"

I would prefer to wait until we get a stable version.

byteab commented 2 years ago

@adelalmaleh2 version "2.2.0" is stable. but not working with react-native@0.66

shirodkarpushkar commented 2 years ago

None of the solution from here worked. So I tried to downgrade react-native version from 0.66 to 0.65.1 and react-native-reanimated:"^2.2.2" so my package.json looks as below in the attached image. image

Project build is successful and no problems / error are seen in metro server :) .

ssjuma commented 2 years ago

if you are using "react-native": "0.66" then use this version of reanimated "react-native-reanimated": "^2.3.0-beta.2"

This worked fine, thanks

ramax79 commented 2 years ago

if you are using "react-native": "0.66" then use this version of reanimated "react-native-reanimated": "^2.3.0-beta.2"

This worked fine, thanks

I have warnings with this configuration and another error attempt to invoke virtual method int java.lang.object java.lang.ref.weakreference.get() on a null object reference

kouohhashi commented 2 years ago

I could not make it work. Could someone show which react-native-reanimated is compatible with which react-native version? Thanks in advance,

wincod75 commented 2 years ago

I could not make it work. Could someone show which react-native-reanimated is compatible with which react-native version? Thanks in advance,

Same here, I had to downgrade RN and roll back reanimated

enlightenedpie commented 2 years ago

If you're like me and you just stumbled upon this, you're most likely getting this error based on incompatible versions of React Native and RNReanimated. I'd be willing to bet you just upgraded your version of React Native. Check to make sure the version of Reanimated you have includes the necessary react-native-reanimated-{YOUR_RN_VERSION}-jsc.aar, and if not, revert your React Native version or see if there's a new release version of Reanimated.

Example: if you've upgraded to RN 0.67, make sure you also bump to react-native-reanimated 2.3.3 (the latest version as of this comment).

I personally lock my dependencies when I upgrade react native, currently looks like:

{
    "react-native": "0.67.3",
    "react-native-reanimated": "2.3.3"
}

I also rimraffed my node_modules folder and re-installed everything.

SectionTN commented 2 years ago

this is already solved since 1 year ago, i'm closing this.