React-native-gesture-handler: [error] package android.support.v4.util doesn't exist

Created on 10 Jul 2019  路  10Comments  路  Source: software-mansion/react-native-gesture-handler

react-native-gesture-handler error

Hi,
I follow the instruction by the react-navigation website : https://reactnavigation.org/docs/en/getting-started.html to add react-navigation:

yarn add react-navigation

yarn add react-native-gesture-handler

react-native link react-native-gesture-handler

and successfully linked

info Linking "react-native-gesture-handler" iOS dependency info iOS module "react-native-gesture-handler" has been successfully linked info Linking "react-native-gesture-handler" Android dependency info Android module "react-native-gesture-handler" has been successfully linked

and then change the MainActivity.java like the docs it asks.

everything runs fine before adding navigation.

Then run react-native run-android emulator, and error pop up :

xxxx/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:3: error: package android.support.v4.util doesn't exist import android.support.v4.util.Pools; ^ xxxx/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:19: error: package Pools doesn't exist private static final Pools.SynchronizedPool<RNGestureHandlerEvent> EVENTS_POOL = ^

Your Environment

| software | version
| ---------------- | -------
| react-navigation | ^3.11.0
| react-native | 0.60.0
| node | v10.14.1
| npm or yarn | npm 6.4.1 yarn 1.16.0
| react-native-gesture-handler | ^1.3.0

I try to solve this by search in issues and stackoverflow, but non of them is working for me.
Any advice or help is needed . Thx.

Most helpful comment

Try :

  1. npm install --save-dev jetifier
  2. npx jetify

All 10 comments

Try :

  1. npm install --save-dev jetifier
  2. npx jetify

@viru99 Hi, Thx, I have try it with jetifier, another error pop up in package react-native-gesture-handler:

null is not an object (evaluating 'rngesturehandlermodule.default.createGestureHandler')

IMG => RNGestHandlerModule null error

Any solutions?

Try to stop Metro Bundler server and restart it react-native start
2.react-native link react-native-gesture-handler

@localnet thx, I have tried to click the file : node_modules - react-native-gesture-handler then Refactor - Migrate to AndriodX. And rebuild but same error [error img] (https://i.loli.net/2019/07/10/5d25996d4655e23135.png)

Still no solutions, I think Maybe I should switch RN version to under 0.60.

@M1seRy Sorry, I have few experience with React Native and none with Java. Only I can say it worked for me, using [email protected]

PS: Try to clear Watchman cache.

I didn't solve it by using jetifier, but I encountered new problems.

Because we need to Add gradle backward-compatibility, check details here => https://github.com/kmagiera/react-native-gesture-handler/issues/743

https://github.com/mikehardy/jetifier

Call npx jetify run in the postinstall target of your package.json (Any time your dependencies update you have to jetify again)

This issue was not active for some time so I'm closing it.
If you need further help please reply.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jacobrosenskold picture jacobrosenskold  路  3Comments

TerrerSandman picture TerrerSandman  路  3Comments

Agoujil2saad picture Agoujil2saad  路  3Comments

alexthebake picture alexthebake  路  3Comments

brunolemos picture brunolemos  路  3Comments