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

App does not compile on Android "compileReleaseJavaWithJavac" #3385

Closed
1 of 3 tasks
Humad opened this issue Jul 13, 2022 · 25 comments
Closed
1 of 3 tasks

App does not compile on Android "compileReleaseJavaWithJavac" #3385

Humad opened this issue Jul 13, 2022 · 25 comments
Assignees
Labels
Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android

Comments

@Humad
Copy link

Humad commented Jul 13, 2022

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

  • Android
  • iOS
  • Web
@Humad Humad added the Needs review Issue is ready to be reviewed by a maintainer label Jul 13, 2022
@github-actions github-actions bot added Platform: Android This issue is specific to Android Missing repro This issue need minimum repro scenario labels Jul 13, 2022
@github-actions
Copy link

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 github-actions bot added the Missing info The user didn't precise the problem enough label Jul 13, 2022
@github-actions
Copy link

Hey! 👋

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

Please complete Snack or minimal code example section.

@piaskowyk
Copy link
Member

piaskowyk commented Aug 3, 2022

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?

Fast fix: You can manually replace this file with this file

@piaskowyk piaskowyk removed the Needs review Issue is ready to be reviewed by a maintainer label Aug 3, 2022
@fogg4444
Copy link

following. Having the same issues

@xtdhwl
Copy link

xtdhwl commented Aug 17, 2022

主工程添加:
//解决编译报错

rootProject.getSubprojects().forEach({ project ->
    if ("react-native-reanimated" == project.name) {
        project.tasks.withType(JavaCompile) {
            compileTask ->
                compileTask.dependsOn("applyJavaPatches")
        }
    }
})

@amanraj0505
Copy link

主工程添加: //解决编译报错

rootProject.getSubprojects().forEach({ project ->
    if ("react-native-reanimated" == project.name) {
        project.tasks.withType(JavaCompile) {
            compileTask ->
                compileTask.dependsOn("applyJavaPatches")
        }
    }
})

where to add this?

@joshsambrook
Copy link

Also having this error. Anyone found a fix yet?

@fogg4444
Copy link

Also having this error. Anyone found a fix yet?

Following

@fogg4444
Copy link

fogg4444 commented Nov 4, 2022

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?

Fast fix: You can manually replace this file with this file

I followed these directions months ago, but now I need to do it again and the links are dead.... :(

@smadan
Copy link

smadan commented Nov 4, 2022

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.

@smadan
Copy link

smadan commented Nov 4, 2022

@piaskowyk can you please link to your "fast fix" again?

@andrew-schenk
Copy link

@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

@prerakd
Copy link

prerakd commented Nov 4, 2022

@andrew-schenk will your change work for RN0.69.6 as well?

@mishkeTz
Copy link

mishkeTz commented Nov 4, 2022

@andrew-schenk That does not work anymore.

@fogg4444
Copy link

fogg4444 commented Nov 4, 2022

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

@fogg4444
Copy link

fogg4444 commented Nov 4, 2022

Linking this issue to the one I just opened. They seem related, possibly duplicates. If they are, sorry for splitting the discussion:

@andrew-schenk
Copy link

There is some logic in android/build.gradle to handle this patching for RN 64 and earlier and then a fallback for anything newer.

// UIImplementation
if (REACT_NATIVE_MINOR_VERSION <= 64) {
srcDirs += "src/reactNativeVersionPatch/UIImplementation/64"
} else {
srcDirs += "src/reactNativeVersionPatch/UIImplementation/latest"

Still not sure why it broke compiling without any changes on our end.

@oleksandr-dziuban
Copy link

oleksandr-dziuban commented Nov 4, 2022

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.

@mishkeTz
Copy link

mishkeTz commented Nov 5, 2022

Have a look at #3743 (comment) and also at related discussion linked in RN bug report.

@ucheNkadiCode
Copy link

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

@piaskowyk
Copy link
Member

Hey, is this issue still happening?

@ucheNkadiCode
Copy link

I honestly upgraded to react native 71.7 and reanimated v3. This is no longer an issue for me.

@piaskowyk
Copy link
Member

@ucheNkadiCode thanks for confirming that it works now 🙌

@Drago33000
Copy link

Fixed it. Use Jdk-17 instead. Jdk 21 is buggy. soon after I switched it started working properly

@talhaibnmahmud
Copy link

Fixed it. Use Jdk-17 instead. Jdk 21 is buggy. soon after I switched it started working properly

This fixed the issue for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android
Projects
None yet
Development

No branches or pull requests