react-native-reanimated
react-native-reanimated copied to clipboard
App does not compile on Android "compileReleaseJavaWithJavac"
Description
I'm trying to build the app by doing ./gradlew assemblerelease
. I now get an error message.
Expected behavior
App builds successfully
Actual behavior & steps to reproduce
App fails to build.
Here is the log:
> Task :react-native-reanimated:compileReleaseJavaWithJavac
/Users/humad/Desktop/tvproject-mobile/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
> Task :react-native-community_datetimepicker:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-haptic-feedback:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-fast-image:compileReleaseJavaWithJavac
Note: [2] Wrote GeneratedAppGlideModule with: [com.bumptech.glide.integration.okhttp3.OkHttpLibraryGlideModule, com.dylanvann.fastimage.FastImageOkHttpProgressGlideModule]
> Task :unimodules-core:compileReleaseJavaWithJavac
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
> Task :react-native-reanimated:compileReleaseJavaWithJavac
/Users/humad/Desktop/tvproject-mobile/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java:11: error: recursive constructor invocation
public ReanimatedUIImplementation(
^
> Task :react-native-firebase_app:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-reanimated:compileReleaseJavaWithJavac FAILED
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.
2 errors
> Task :expo-application:compileReleaseJavaWithJavac
Note: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-application/android/src/main/java/expo/modules/application/ApplicationModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :expo-dev-menu:compileReleaseKotlin
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-menu/android/src/release/java/expo/modules/devmenu/DevMenuManager.kt: (22, 42): Returning type parameter has been inferred to Nothing implicitly. Please, specify type arguments explicitly to hide this warning. Nothing can produce an exception at runtime.
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-menu/android/src/release/java/expo/modules/devmenu/DevMenuManager.kt: (84, 43): The corresponding parameter in the supertype 'DevMenuManagerInterface' is named 'shouldAutoLaunch'. This may cause problems when calling this function with named arguments.
> Task :expo-dev-launcher:compileReleaseKotlin
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/DevLauncherActivity.kt: (31, 25): 'constructor Handler()' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (33, 49): 'constructor TaskDescription(String!, Bitmap!, Int)' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (57, 61): 'FLAG_TRANSLUCENT_STATUS: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (87, 47): 'getter for systemUiVisibility: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (90, 70): 'SYSTEM_UI_FLAG_LIGHT_STATUS_BAR: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (94, 69): 'SYSTEM_UI_FLAG_LIGHT_STATUS_BAR: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (98, 69): 'SYSTEM_UI_FLAG_LIGHT_STATUS_BAR: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (102, 17): 'setter for systemUiVisibility: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (110, 59): 'FLAG_FULLSCREEN: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (111, 61): 'FLAG_FORCE_NOT_FULLSCREEN: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (113, 59): 'FLAG_FORCE_NOT_FULLSCREEN: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (114, 61): 'FLAG_FULLSCREEN: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (126, 23): 'replaceSystemWindowInsets(Int, Int, Int, Int): WindowInsets' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (127, 25): 'getter for systemWindowInsetLeft: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (129, 25): 'getter for systemWindowInsetRight: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/launcher/configurators/DevLauncherExpoActivityConfigurator.kt: (130, 25): 'getter for systemWindowInsetBottom: Int' is deprecated. Deprecated in Java
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/release/java/expo/modules/devlauncher/DevLauncherController.kt: (92, 20): Parameter 'context' is never used
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/release/java/expo/modules/devlauncher/DevLauncherController.kt: (92, 38): Parameter 'reactNativeHost' is never used
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/release/java/expo/modules/devlauncher/DevLauncherController.kt: (98, 64): Parameter 'cazz' is never used
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/release/java/expo/modules/devlauncher/DevLauncherController.kt: (103, 35): Parameter 'reactActivity' is never used
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/release/java/expo/modules/devlauncher/DevLauncherController.kt: (108, 27): Parameter 'reactActivity' is never used
w: /Users/humad/Desktop/tvproject-mobile/node_modules/expo-dev-launcher/android/src/release/java/expo/modules/devlauncher/DevLauncherController.kt: (108, 57): Parameter 'intent' is never used
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-reanimated:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 56s
512 actionable tasks: 512 executed
Snack or minimal code example
Package versions
name | version |
---|---|
react-native | 0.63.4 |
react-native-reanimated | 2.3.0-beta.1 (but I've also tried with the latest version) |
NodeJS | 16.14 |
Xcode | N/A |
Java | openjdk 11.0.11 |
Gradle | 6.3 |
expo | 42 (but I dont use it) |
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.
Hey @Humad 👋 I have just tried to reproduce your issue, but I couldn't. This issue is because the gradle task applyJavaPatches didn't start. We replace files during applyJavaPatches to provide backward compatibility. I am not sure why this task didn't execute in your case. Maybe you have a custom Gradle configuration. Could you provide me a repo with a reproducible example?
following. Having the same issues
主工程添加: //解决编译报错
rootProject.getSubprojects().forEach({ project ->
if ("react-native-reanimated" == project.name) {
project.tasks.withType(JavaCompile) {
compileTask ->
compileTask.dependsOn("applyJavaPatches")
}
}
})
主工程添加: //解决编译报错
rootProject.getSubprojects().forEach({ project -> if ("react-native-reanimated" == project.name) { project.tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn("applyJavaPatches") } } })
where to add this?
Also having this error. Anyone found a fix yet?
Also having this error. Anyone found a fix yet?
Following
Hey @Humad 👋 I have just tried to reproduce your issue, but I couldn't. This issue is because the gradle task applyJavaPatches didn't start. We replace files during applyJavaPatches to provide backward compatibility. I am not sure why this task didn't execute in your case. Maybe you have a custom Gradle configuration. Could you provide me a repo with a reproducible example?
I followed these directions months ago, but now I need to do it again and the links are dead.... :(
Yeah this crash seems to have appeared again in the last day or so. I have no idea why. @xtdhwl's fix was working just fine until 2 days ago and now I'm seeing this same exact crash again.
@piaskowyk can you please link to your "fast fix" again?
@smadan here is the fix file for 63. I am on RN 70 and running into this same bug. https://github.com/software-mansion/react-native-reanimated/blob/e5913bea53c25a2a7dcb308c1e52b6e888d90867/android/rnVersionPatch/63/layoutReanimation/ReanimatedUIImplementation.java
@andrew-schenk will your change work for RN0.69.6 as well?
@andrew-schenk That does not work anymore.
Yeah, I believe the files have changed names / locations in subsequent releases. Tried this manually on 0.65 and it didn't look like it was going to work
Linking this issue to the one I just opened. They seem related, possibly duplicates. If they are, sorry for splitting the discussion:
- https://github.com/software-mansion/react-native-reanimated/issues/3743
There is some logic in android/build.gradle
to handle this patching for RN 64 and earlier and then a fallback for anything newer.
https://github.com/software-mansion/react-native-reanimated/blob/d665dcf796612764745a91013f7629c4185caf3b/android/build.gradle#L549-L553
Still not sure why it broke compiling without any changes on our end.
Today the issue is active again on our CI.... Yesterday all builds were green, but today without any changes builds fails.
Error is now 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.
Have a look at https://github.com/software-mansion/react-native-reanimated/issues/3743#issuecomment-1304127794 and also at related discussion linked in RN bug report.
I noticed that react-native-reanimated 2.12.0 uses React-Native 70+ and React 17 so I had to upgrade to those versions.
Still working through all of the extra work that entails
Hey, is this issue still happening?
I honestly upgraded to react native 71.7 and reanimated v3. This is no longer an issue for me.
@ucheNkadiCode thanks for confirming that it works now 🙌
Fixed it. Use Jdk-17 instead. Jdk 21 is buggy. soon after I switched it started working properly
Fixed it. Use Jdk-17 instead. Jdk 21 is buggy. soon after I switched it started working properly
This fixed the issue for me