Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Java patch doesn't seem to be applied when building from cache #3138

Closed
1 of 3 tasks
Looooong opened this issue Apr 5, 2022 · 16 comments
Closed
1 of 3 tasks
Labels
Close when stale This issue is going to be closed when there is no activity for a while Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Needs review Issue is ready to be reviewed by a maintainer Platform: Android This issue is specific to Android 🏠 Reanimated 2

Comments

@Looooong
Copy link

Looooong commented Apr 5, 2022

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

  • Android
  • iOS
  • Web
@Looooong Looooong added the Needs review Issue is ready to be reviewed by a maintainer label Apr 5, 2022
@github-actions github-actions bot added the Missing repro This issue need minimum repro scenario label Apr 5, 2022
@github-actions
Copy link

github-actions bot commented Apr 5, 2022

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?

@github-actions
Copy link

github-actions bot commented Apr 5, 2022

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Snack or minimal code example section.

@github-actions github-actions bot added Missing info The user didn't precise the problem enough Platform: Android This issue is specific to Android labels Apr 5, 2022
@jzxchiang1
Copy link

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?

@FabioMFGaspar
Copy link

I'm also having this problem.
I've RN 0.63.4 and react-native-reanimated 2.5.0

@cleandevcode
Copy link

"react-native": "0.63.4",
"react-native-reanimated": "^2.4.1",

I have same issue.

@cleandevcode
Copy link

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!

@agilbani
Copy link

yarn run android

im still facing error

@FabioMFGaspar
Copy link

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

@kayallapl-zz
Copy link

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

@Looooong
Copy link
Author

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.

@ratz6
Copy link

ratz6 commented Jul 14, 2022

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 >

image

But If do yarn install even without changing anything in package.json I see the reanimated-64.aar file not available ?

image

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 ?

@fogg4444
Copy link

I wish I could solve this.....

@github-actions
Copy link

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?

@fogg4444
Copy link

fogg4444 commented Nov 4, 2022

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...

@oleksandr-dziuban
Copy link

oleksandr-dziuban commented Nov 4, 2022

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.

@oleksandr-dziuban
Copy link

@Latropos Latropos added 🏠 Reanimated 2 Close when stale This issue is going to be closed when there is no activity for a while labels Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Close when stale This issue is going to be closed when there is no activity for a while Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Needs review Issue is ready to be reviewed by a maintainer Platform: Android This issue is specific to Android 🏠 Reanimated 2
Projects
None yet
Development

No branches or pull requests

10 participants