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:
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\srcmain\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\srcmain\java\com\reduxtest\MainActivity.java:24: error: cannot find symbol
return new RNGestureHandlerEnabledRootView(MainActivity.this);
^
symbol: class RNGestureHandlerEnabledRootView
2 errorsFAILURE: 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\srcmain\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\srcmain\java\com\reduxtest\MainActivity.java:24: error: cannot find symbol
return new RNGestureHandlerEnabledRootView(MainActivity.this);
^
symbol: class RNGestureHandlerEnabledRootView
2 errorsFAILURE: 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.
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,
},
},
},
};
I am experiencing the same error too. and i tryed version 1.1.2 ,it still not work
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
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_
This is the same issue with me
look this https://github.com/kmagiera/react-native-gesture-handler/issues/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
It works with react-native run-ios but not from Xcode (both workspace and project)
react-native gesture handler is not working after recent release can anyone tell me how i can use it??
app/src/main/java/com.xxx/MainActivity.java
change
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRoot;
to
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
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 :(
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.
This should be fixed in newer releases.
Most helpful comment
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.jsfile at your project root with following content:I've solved this issue by manually linking the lib for android:
In your MainApplication.java you will add:
In your android/app/build.gradle add
implementation project(':react-native-gesture-handler')and inside android/settings.gradle add these two lines:
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 -rfyournode_modulesdir before building the app_