1
votes

I'm gettign this annoying error:

Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED D:\FifaLeagueApp\FifaIL\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerModule.java:16: error: package com.facebook.react.module.annotations does not exist

I've tried many things but none helped...

android.useAndroidX=true
android.enableJetifier=true

build.gradle dependencies :

dependencies {
    implementation project(':react-native-exit-app')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-splash-screen')
    implementation project(':react-native-restart')
    implementation project(':react-native-gesture-handler')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:23.2.0' // v4
    implementation 'com.android.support:support-v13:23.2.0' //v13
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.annotation:annotation:1.0.2'
    implementation "com.facebook.react:react-native:+"  // From node_modules
}

Don't know what to try anymore... any ideas?

3
You can follow the following answer to fix it. [stackoverflow.com/a/56930244/10456375]Harsh Panchal

3 Answers

3
votes

2 possible solutions:

1) mismatch version of RN and GestureHandler put an exact version of you react-native for example:

implementation "com.facebook.react:react-native:0.57.5"

2) Your version of RN is too low and you need to downgrade your gesture handler by

npm i [email protected] -D -E

or update version of RN but it may break other libraries.

1
votes

It causes this error for the RN 0.60. You can solve this by following

sudo npm i jetifier 
sudo npx jetify
0
votes

You can open gradle.properties and add following code:

android.useAndroidX=false
android.enableJetifier=false