Daniel Loiterton
Daniel Loiterton

Reputation: 5308

react-native-reanimated:androidJavadoc errors running react-native app on android devices

I'm not sure what I've changed, but I can no longer get my app running on android devices. Running npx react-native run-android --deviceId abcdefg123 results in the following errors:

info Done writing bundle output
info Done writing sourcemap output
info Copying 47 asset files
info Done copying assets

> Task :react-native-reanimated:androidJavadoc FAILED
/Users/[....]/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java:5: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.Arguments;
                                ^
/Users/[....]/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java:6: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.Callback;
                                ^
/Users/[....]/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java:7: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.GuardedRunnable;
                                ^
/Users/[....]/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java:8: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;

...plus loads more similar errors, then...

100 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-reanimated:androidJavadoc'.
> Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/Users/[....]/node_modules/react-native-reanimated/android/build/tmp/androidJavadoc/javadoc.options'

* 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.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1m 33s
2342 actionable tasks: 6 executed, 2336 up-to-date
error Failed to build the app. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew build -x lint
    at makeError (/Users/[....]/node_modules/execa/index.js:174:9)
error Command failed with exit code 1.

I've been going in circles for a day now, trying to figure it out but I keep coming back to this error. Any ideas what I've done wrong, or what to try next?


Update:

If I remove the --deviceId flag, the app will run on the android emulator just fine. And it also works if I plug in a Samsung device I have.

When I plug in another device (Mi Max 2), I'm now getting a different error - see this post

However, the react-native-reanimated:androidJavadoc error described above still persists for both devices when I attempt to target either of them directly with the deviceId flag.

Upvotes: 1

Views: 4204

Answers (1)

Ulysse Tunde
Ulysse Tunde

Reputation: 11

I was able to solve this issue, by following the installation guide of React-native-reanimated. First install :

yarn add react-native-reanimated@next

  • Turn on Hermes engine by editing android/app/build.gradle :

project.ext.react = [ enableHermes: true // <- here | clean and rebuild if changing ]

  • Plug Reanimated in MainApplication.java

import com.facebook.react.bridge.JSIModulePackage; // <- add import com.swmansion.reanimated.ReanimatedJSIModulePackage; // <- add ... private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { ...

 @Override
 protected String getJSMainModuleName() {
   return "index";
 }

 @Override
 protected JSIModulePackage getJSIModulePackage() {
   return new ReanimatedJSIModulePackage(); // <- add
 }

}; ...

  • Then clean your project and Build using ./gradlew clean and ./gradlew build in android folder of your project.

https://docs.swmansion.com/react-native-reanimated/docs/installation

Upvotes: 1

Related Questions