Execution failed for task ':react-native-gesture-handler:compileDebugJavaWithJavac'
Solution 1
It cause this error for the RN 0.60
.
You can solve this by following,
npm i jetifier
npx jetify
fixed it for me on RN 0.60
.
Have a good day.
Solution 2
npm i jetifier
npx jetify
Fixed it for me on react-native 0.60
Be carefully for latest react-native version don't need
react-native link react-native-gesture-handler
It is automatically linked by react-native 0.60
Related videos on Youtube
Comments
-
user938363 almost 2 years
I am fixing a incompatibility issue related to AndroidX by adding 2 lines to
gradle.properties
underandroid
for my RN 0.59 project.android.useAndroidX=true android.enableJetifier=true
Now there is another error with
run-android
related toreact-native-gesture-handler
. Then Iyarn remove
the currentreact-native-gesture-handler
of1.2.0
and add it back. The new version is1.3.0
. Here is the error:> Task :react-native-gesture-handler:compileDebugJavaWithJavac C:\D\code\js\emps_app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:3: error: package android.support.v4.util does not exist import android.support.v4.util.Pools; ^ C:\D\code\js\emps_app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:19: error: package Pools does not exist private static final Pools.SynchronizedPool<RNGestureHandlerEvent> EVENTS_POOL = ^ C:\D\code\js\emps_app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:3: error: package android.support.v4.util does not exist import android.support.v4.util.Pools; ^ C:\D\code\js\emps_app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:19: error: package Pools does not exist private static final Pools.SynchronizedPool<RNGestureHandlerStateChangeEvent> EVENTS_POOL = ^ C:\D\code\js\emps_app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:20: error: package Pools does not exist new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE); ^ C:\D\code\js\emps_app\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:20: error: package Pools does not exist new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE); ^ Note: C:\D\code\js\emps_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. 6 errors > Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED FAILURE: Build failed with an exception.
The error is related 6 packages missing and I guess it is still related to Androidx. But I have no clue how to fix it. There is an issue post (for RN-gesture-handler) suggesting downgraded to version
1.0.5
for fixing but I wouldn't like to use such an old version. -
user938363 almost 5 yearsVerified that
react-native-gesture-handler
had already been linked. The error is the same after link -
kumar ujjawal almost 5 yearsOhk .I can suggest you one more solution.You can try removing node modules from your project and then run this comand:-(npm install --save).And then after installing node modules run one more command (react-native link).i hope it will work.
-
Nagibaba over 4 yearsthis works but, you must be sure that
gradle.properties
contains thisandroid.useAndroidX=true android.enableJetifier=true