androidreact-nativeandroid-gradle-plugin

How to fix missing package "com.swmansion.gesturehandler.react"?


When I tried to set up React navigation, I also installed React Native gesture handler.

I have added all the required things into the Main Activity class by following guidelines from https://reactnavigation.org/docs/3.x/getting-started

After that I'm getting the following error message:

\MainActivity.java:9: error: package com.swmansion.gesturehandler.react does not exist
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
                                         ^
D:\ReactNative\taskproject\android\app\src\main\java\com\taskproject\MainActivity.java:28: error: cannot find symbol
                return new RNGestureHandlerEnabledRootView(MainActivity.this);
                           ^
  symbol: class RNGestureHandlerEnabledRootView
2 errors

Is there any workaround? I'm banging my head for the past 2 days. Or do I have to set up something in Gradle? I have linked the React gesture, but it still doesn't work for me.


Solution

  • When i ran react-native gesture handle --link, It does got added to build.gradle

    I manually added the dependencies to build.gradle