question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sjchmielacommented, Mar 25, 2019

In https://github.com/dhee9000/expo-camera-issue/blob/master/android/build.gradle, could you try changing:

        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
            url "$rootDir/../node_modules/expo-camera/android/maven"
        }

to

        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url "$rootDir/../node_modules/expo-camera/android/maven"
        }

🙂

0reactions
brentvatnecommented, Mar 26, 2019

thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installation in React Native and bare projects
Learn how to configure development builds for bare React Native projects. ... and do not have any other Expo packages installed, you'd need...
Read more >
Installation | React Native Gesture Handler
To use the version of react-native-gesture-handler that is compatible with your managed Expo project, run expo install react-native-gesture-handler .
Read more >
Unable to resolve module `react-native-gesture-handler`
Gesture Handler not found in your react native project. run this command npm install react-native-gesture-handler.
Read more >
expo failed to resolve plugin for module
expo install react-native-fbsdk-next react-native-fbads eas build --profile ... If it is not set * on project.ext.react, JavaScript will not be compiled to ...
Read more >
gatsby-plugin-react-native-web
Install additional unimodules / cross-platform libraries. yarn expo install react-native-svg yarn expo install expo-camera. Using yarn expo install myExpoLib is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found