installing expo-camera to a bare React Native project with react-native-gesture-handler already installed causes it to not compile
See original GitHub issue🐛 Bug Report
Environment
Bare React Native 0.58.5 Project Installed react-native-unimodules 0.2.0
Steps to Reproduce
Install expo-camera after installing react-native-unimodules on top of a project with react-native-gesture-handler already installed.
After installing unimodules, it compiles fine, but, after installing expo-camera via the exact steps listed on the package Github README, it no longer compiles on android.
SEE REPRODUCIBLE DEMO SECTION FOR EXACT STEPS
The error is at this gradle task:
Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED
Expected Behavior
Should just compile and allow use of the expo-camera module since the listed steps were followed exactly.
Actual Behavior
Does not compile, gives this output (excerpt):
> Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:16: error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:19: error: cannot find symbol
import com.facebook.react.uimanager.UIBlock;
^
symbol: class UIBlock
location: package com.facebook.react.uimanager
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:40: error: cannot find symbol
@ReactModule(name=RNGestureHandlerModule.MODULE_NAME)
^
symbol: class ReactModule
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRootViewManager.java:4: error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerRootViewManager.java:17: error: cannot find symbol
@ReactModule(name = RNGestureHandlerRootViewManager.REACT_CLASS)
^
symbol: class ReactModule
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerButtonViewManager.java:218: error: cannot find symbol
@ReactProp(name = ViewProps.BORDER_RADIUS)
^
symbol: variable BORDER_RADIUS
location: class ViewProps
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:41: error: method init in class Event<T> cannot be applied to given types;
super.init(handler.getView().getId());
^
required: int,long
found: int
reason: actual and formal argument lists differ in length
where T is a type-variable:
T extends Event declared in class Event
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:574: error: cannot find symbol
final int rootViewTag = uiManager.resolveRootTagFromReactTag(ancestorViewTag);
^
symbol: method resolveRootTagFromReactTag(int)
location: variable uiManager of type UIManagerModule
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:582: error: cannot find symbol
if (root.getRootView().getRootViewTag() == rootViewTag) {
^
symbol: method getRootViewTag()
location: class ReactRootView
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:598: error: cannot find symbol
uiManager.addUIBlock(new UIBlock() {
^
symbol: class UIBlock
location: class RNGestureHandlerModule
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:634: error: cannot find symbol
int rootViewTag = uiManager.resolveRootTagFromReactTag(viewTag);
^
symbol: method resolveRootTagFromReactTag(int)
location: variable uiManager of type UIManagerModule
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:641: error: cannot find symbol
if (root.getRootView().getRootViewTag() == rootViewTag) {
^
symbol: method getRootViewTag()
location: class ReactRootView
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerPackage.java:18: error: RNGestureHandlerPackage is not abstract and does not override abstract method createJSModules() in ReactPackage
public class RNGestureHandlerPackage implements ReactPackage {
^
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:45: error: method init in class Event<T> cannot be applied to given types;
super.init(handler.getView().getId());
^
required: int,long
found: int
reason: actual and formal argument lists differ in length
where T is a type-variable:
T extends Event declared in class Event
C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNViewConfigurationHelper.java:44: error: cannot find symbol
return parent.getChildAt(((ReactViewGroup) parent).getZIndexMappedChildIndex(index));
^
symbol: method getZIndexMappedChildIndex(int)
location: class ReactViewGroup
Note: C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerButtonViewManager.java uses or overrides 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.
15 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-gesture-handler:compileDebugJavaWithJavac'.
> 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
BUILD FAILED in 30s
197 actionable tasks: 14 executed, 183 up-to-date
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Command failed: gradlew.bat installDebug
Error: Command failed: gradlew.bat installDebug
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:13)
at runOnAllDevices (C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (C:\Users\dheeraj\Documents\Ripplify\repos\ripplify-app\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12) at process._tickCallback (internal/process/next_tick.js:68:7)
Reproducible Demo
A repo with the steps produced on it:
Repo . . .
Steps
react-native init AwesomeProject
yarn add react-native-gesture-handler
react-native link
yarn add react-native-unimodules
Follow setup steps after that at: Official Guide
react-native run-android
At this point, it will work fine. (RN default screen should show).
yarn add expo-camera
Follow setup steps after that at: Official Guide
react-native run-android
At this point, the build will fail with an error very similar to the one given above.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
In https://github.com/dhee9000/expo-camera-issue/blob/master/android/build.gradle, could you try changing:
to
🙂
thanks!