[Updated]RN: 0.60.0 compile error : RNGestureHandlerEnabledRootView(MainActivity.this) && “can’t find symbol”

I’m trying to install react-navigation package to my project. I did all instructions on here and I search on GitHub, StackOverflow but can’t find any solution, still getting error while compiling

My package.json:

  • "react": "16.8.6",
    
  • "react-native": "0.60.0",
    
  • "react-native-gesture-handler": "^1.3.0",
    
  • "react-native-safe-area-view": "^0.14.6",
    
  • "react-navigation": "^3.11.0",
    
  • "react-redux": "^7.1.0",
    
  • "redux": "^4.0.3"
    

Error output:

Task :app:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
13 actionable tasks: 2 executed, 11 up-to-date
C:\Users\ezran\Desktop\SADELABS\reduxTest\android\app\src\main\java\com\reduxtest\MainActivity.java:6: error: package com.swmansion.gesturehandler.react does
not exist
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
^
C:\Users\ezran\Desktop\SADELABS\reduxTest\android\app\src\main\java\com\reduxtest\MainActivity.java:24: error: cannot find symbol
return new RNGestureHandlerEnabledRootView(MainActivity.this);
^
symbol: class RNGestureHandlerEnabledRootView
2 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app: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 7s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with –verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
C:\Users\ezran\Desktop\SADELABS\reduxTest\android\app\src\main\java\com\reduxtest\MainActivity.java:6: error: package com.swmansion.gesturehandler.react does
not exist
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
^
C:\Users\ezran\Desktop\SADELABS\reduxTest\android\app\src\main\java\com\reduxtest\MainActivity.java:24: error: cannot find symbol
return new RNGestureHandlerEnabledRootView(MainActivity.this);
^
symbol: class RNGestureHandlerEnabledRootView
2 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app: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 7s

at checkExecSyncError (child_process.js:616:11)
at execFileSync (child_process.js:634:13)
at runOnAllDevices (C:\Users\ezran\Desktop\SADELABS\reduxTest\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:75:39)
at buildAndRun (C:\Users\ezran\Desktop\SADELABS\reduxTest\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:137:41)
at then.result (C:\Users\ezran\Desktop\SADELABS\reduxTest\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:103:12)
at process._tickCallback (internal/process/next_tick.js:68:7)

Any help?

EDIT: I create a new project to test on new React Native version and getting new errors. Maybe we can follow this issue for help.

Author: Fantashit

4 thoughts on “[Updated]RN: 0.60.0 compile error : RNGestureHandlerEnabledRootView(MainActivity.this) && “can’t find symbol”

  1. I’ve found a solution (maybe its just a hack).

    So in order to pass through this issue you need to create react-native.config.js file at your project root with following content:

    module.exports = {
      dependencies: {
        "react-native-gesture-handler": {
          platforms: {
            android: null,
            ios: null
          }
        }
      }
    };
    

    I’ve solved this issue by manually linking the lib for android:

    In your MainApplication.java you will add:

    package yourpackage;
    
    ...
    
    import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
    ...
    
    public class MainApplication extends Application implements ReactApplication {
        ...
    
        @Override
        protected List<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
          // Add RNGestureHandler manually!
          packages.add(new RNGestureHandlerPackage());
          return packages;
        }
    . ..
    
    

    In your android/app/build.gradle add implementation project(':react-native-gesture-handler')

    and inside android/settings.gradle add these two lines:

    ...
    include ':react-native-gesture-handler'
    project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
    ...
    

    Now build and run and it should work (at least it worked for me…)!

    Also dont forget to use jetifier for other problems.
    Maybe you should also try to rm -rf your node_modules dir before building the app

  2. look this #691

    if RN >= 0.60.0

    vim ios/Podfile

    add line code

    pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'
    

    run pod install

    react-native run-ios

    you can solve the problem

  3. app/src/main/java/com.xxx/MainActivity.java
    change
    import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRoot;
    to
    import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;

  4. I’m still experiencing this issue, I’ve tried all other solutions but nothing…
    clean, rebuild, autolinking, manual linking, jetify, nothing works…

    I’m getting always

    Expect view tag to be set for com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView
    

    my package:

    "react": "16.8.6",
    "react-native": "0.60.5",
    "react-native-gesture-handler": "^1.4.1",
    "react-native-reanimated": "^1.2.0",
    "react-navigation": "^4.0.0",

    thanks for any helps, I’ve been stuck for days 🙁

Comments are closed.