react-native-reanimated
react-native-reanimated copied to clipboard
[Android] Java patch doesn't seem to be applied when building from cache
Description
Since I upgraded to version 2.5.0, whenever I change a dependency not related to react-native-reanimated
and start an Android build from existing cache, the ReanimatedUIImplementation.java
doesn't seem to be patched and will result in the following error:
...\node_modules\react-native-reanimated\android\src\main\java\com\swmansion\reanimated\layoutReanimation\ReanimatedUIImplementation.java:13: error: cannot find symbol
ViewManagerResolver viewManagerResolver,
^
symbol: class ViewManagerResolver
location: class ReanimatedUIImplementation
Cleaning Android build and re-building from scratch does work. However, this means that our CI cannot rely on Android build cache anymore.
Expected behavior
I should be able to re-build sucessfully from cache whenever Android project or dependency changes.
Actual behavior & steps to reproduce
Snack or minimal code example
Package versions
name | version |
---|---|
react-native | 0.63.4 |
react-native-reanimated | 2.5.0 |
NodeJS | 14.17.0 |
Xcode | |
Java | 1.8 |
Gradle | 4.1.2 |
expo |
Affected platforms
- [x] Android
- [ ] iOS
- [ ] Web
Hey! 👋
The issue doesn't seem to contain a minimal reproduction.
Could you provide a snippet of code, a snack or a link to a GitHub repository that reproduces the problem?
Hey! 👋
It looks like you've omitted a few important sections from the issue template.
Please complete Snack or minimal code example section.
Unfortunately I get this error even after I run cd android && ./gradlew clean
.
I'm on RN 0.64.2 and 2.6.0.
Any idea what may be going wrong?
I'm also having this problem. I've RN 0.63.4 and react-native-reanimated 2.5.0
"react-native": "0.63.4", "react-native-reanimated": "^2.4.1",
I have same issue.
I fixed this way.
yarn remove react-native-reanimated
yarn add react-native-reanimated@^2.4.1
yarn run android
It worked like a charm!
yarn run android
im still facing error
I manage to fix this by updating the React, react-native and babel/core versions
react: 16.13.1 -> 17.0.2 react-native: 0.63.4 -> 0.66.1 @babel/core: ^7.8.4 -> ^7.12.9
I think that only updating react might solve it but I updated the 3
I fixed this way.
yarn remove react-native-reanimated
yarn add react-native-reanimated@^2.4.1
yarn run android
It worked like a charm!
Thank you!! Worked for me
I don't get this error anymore after upgrading both React and React Native
react: 16.13.1 -> 17.0.2
react-native: 0.63.4 -> 0.64.3
Probably, for Reanimated 2.5.0, React Native version should be upgraded to 0.64 or newer.
We use RN version "0.64.2" and REA version "^2.8.0" If I use the old node modules I see this structure in re-animated >
But If do yarn install even without changing anything in package.json I see the reanimated-64.aar file not available ?
I'm able to work if I use the old node modules and that's possible until I change the package.json. Should I spend my time upgrading the RN version (which is a pain as unimodules are involved) or what else can be done here from reanimated side ?
I wish I could solve this.....
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?
So, do we know why this works? It's about the patching not applying unless you completely re-install? I've had issues pop up with this library for months across various versions of React and React Native. Can't seem to find what the root cause is...
Same error reproducible for our project on CI for release Android build:
React v18.0.0 React Native v0.69.6 React Native Reanimated: v2.10.0
Task :react-native-reanimated:compileReleaseJavaWithJavac FAILED
/builds/engineering/mobile/live-investing-app/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java:15: error: cannot find symbol
class ReaUiImplementationProvider extends UIImplementationProvider {
^
symbol: class UIImplementationProvider
/builds/engineering/mobile/live-investing-app/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java:17: error: method does not override or implement a method from a supertype
@Override
^
/builds/engineering/mobile/live-investing-app/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java:38: error: no suitable constructor found for UIManagerModule(ReactApplicationContext,List<ViewManager>,ReaUiImplementationProvider,int)
super(
^
constructor UIManagerModule.UIManagerModule(ReactApplicationContext,ViewManagerResolver,int) is not applicable
(actual and formal argument lists differ in length)
constructor UIManagerModule.UIManagerModule(ReactApplicationContext,List<ViewManager>,int) is not applicable
(actual and formal argument lists differ in length)
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.
3 errors
FAILURE: Build failed with an exception.
Locally debug and release Android build works fine. Only when we build Android app on CI with cached npm modules it throws an error.
https://github.com/facebook/react-native/issues/35210