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

[Updated]RN: 0.60.0 compile error : RNGestureHandlerEnabledRootView(MainActivity.this) && "can't find symbol" #684

Closed
ezranbayantemur opened this issue Jul 11, 2019 · 12 comments
Assignees
Labels
Platform: Android This issue is specific to Android

Comments

@ezranbayantemur
Copy link

ezranbayantemur commented Jul 11, 2019

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.

@ziban
Copy link

ziban commented Jul 11, 2019

I am experiencing the same error too. Edit: A solution might be removing android in react-native.config.js ie module.exports = { dependencies: { 'react-native-gesture-handler': { platforms: { ios: null, }, }, }, };

@csyaonie
Copy link

I am experiencing the same error too. and i tryed version 1.1.2 ,it still not work

@ezranbayantemur ezranbayantemur changed the title RN: 0.60.0 compile error : RNGestureHandlerEnabledRootView(MainActivity.this) && "can't find symbol" [Updated]RN: 0.60.0 compile error : RNGestureHandlerEnabledRootView(MainActivity.this) && "can't find symbol" Jul 11, 2019
@sebqq
Copy link

sebqq commented Jul 12, 2019

I've created a new project and installed this package but I'm still getting the same error. My react-native version is 0.60.3

@sebqq
Copy link

sebqq commented Jul 12, 2019

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

@amanrathore10
Copy link

This is the same issue with me

@wqzwh
Copy link

wqzwh commented Jul 16, 2019

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

@maximerenou
Copy link

It works with react-native run-ios but not from Xcode (both workspace and project)

@s7k11
Copy link

s7k11 commented Jul 29, 2019

react-native gesture handler is not working after recent release can anyone tell me how i can use it??

@lp4298707
Copy link

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

@mrigo
Copy link

mrigo commented Sep 16, 2019

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 :(

@yvdmeij
Copy link

yvdmeij commented Feb 11, 2020

I've run into the same issue and after using yarn instead of using npm as the website suggests to install the packages:

npm install @react-navigation/native

& the dependencies:

npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view

I used yarn to add (install) the packages and dependencies:

yarn add @react-navigation/native

&

yarn add react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view

This worked for me.

@jakub-gonet jakub-gonet self-assigned this Aug 25, 2020
@jakub-gonet jakub-gonet added the Platform: Android This issue is specific to Android label Sep 3, 2020
@jakub-gonet
Copy link
Member

This should be fixed in newer releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android This issue is specific to Android
Projects
None yet
Development

No branches or pull requests