react-native-gesture-handler icon indicating copy to clipboard operation
react-native-gesture-handler copied to clipboard

Task :react-native-gesture-handler:compileDebugKotlin FAILED

Open Gfr1992 opened this issue 4 years ago • 11 comments

Description

Hi, after updating react-native-gesture-handler from version "1.10.3" to "2.4.2", I'm having the following error:

Task :react-native-gesture-handler:compileDebugKotlin FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings 208 actionable tasks: 17 executed, 191 up-to-date e: /Users/user_name/Projects/project_name/frontend/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt: (11, 22): Unresolved reference: common e: /Users/user_name/Projects/project_name/frontend/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt: (17, 47): Unresolved reference: GestureHandlerStateManager e: /Users/user_name/Projects/project_name/frontend/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt: (400, 3): 'setGestureHandlerState' overrides nothing

Platforms

  • [ ] iOS
  • [X] Android
  • [ ] Web

Package versions

  • React: 16.13.1
  • React Native: 0.63.3
  • React Native Gesture Handler: 2.4.2
  • React Native Reanimated: 2.8.0

Gfr1992 avatar May 30 '22 20:05 Gfr1992

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snippet of code, a snack or a link to a GitHub repository that reproduces the problem?

github-actions[bot] avatar May 30 '22 20:05 github-actions[bot]

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Steps To Reproduce and Snack or minimal code example sections.

github-actions[bot] avatar May 30 '22 20:05 github-actions[bot]

Hi! This is weird, since it looks like Gesture Handler correctly detects there is Reanimated installed, but it doesn't include it as a dependency. You can try removing the node_modules directory and installing the dependencies again, and clearing the Android project (./gradlew clean or Build -> Clean Project in Android Studio).

j-piasecki avatar Jun 01 '22 07:06 j-piasecki

Hi! This is weird, since it looks like Gesture Handler correctly detects there is Reanimated installed, but it doesn't include it as a dependency. You can try removing the node_modules directory and installing the dependencies again, and clearing the Android project (./gradlew clean or Build -> Clean Project in Android Studio).

Done. Now I have this error:

`e: /Users/user_name/Projects/project_name/frontend/node_modules/react-native-gesture-handler/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt: (5, 22): Unresolved reference: reanimated e: /Users/user_name/Projects/project_name/frontend/node_modules/react-native-gesture-handler/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt: (8, 35): Unresolved reference: ReanimatedModule e: /Users/user_name/Projects/project_name/frontend/node_modules/react-native-gesture-handler/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt: (12, 56): Not enough information to infer type variable T e: /Users/user_name/Projects/project_name/frontend/node_modules/react-native-gesture-handler/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt: (12, 72): Unresolved reference: ReanimatedModule e: /Users/user_name/Projects/project_name/frontend/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt: (14, 22): Unresolved reference: common e: /Users/user_name/Projects/project_name/frontend/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt: (25, 47): Unresolved reference: GestureHandlerStateManager e: /Users/user_name/Projects/project_name/frontend/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt: (410, 3): 'setGestureHandlerState' overrides nothing

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':react-native-gesture-handler:compileDebugKotlin'.`

Looking at the code in ReanimatedEventDispatcher.kt and the dependencies, it looks like I do miss ReanimatedModule:

`package com.swmansion.gesturehandler

import com.facebook.react.bridge.ReactContext import com.facebook.react.uimanager.events.Event import com.swmansion.reanimated.ReanimatedModule

object ReanimatedEventDispatcher { private var reanimatedModule: ReanimatedModule? = null

fun <T : Event<T>>sendEvent(event: T, reactApplicationContext: ReactContext) {
    if (reanimatedModule == null) {
        reanimatedModule = reactApplicationContext.getNativeModule(ReanimatedModule::class.java)
    }

    reanimatedModule?.nodesManager?.onEventDispatch(event)
}

} `

image

Gfr1992 avatar Jun 04 '22 08:06 Gfr1992

Any solution?

ditherized avatar Jun 06 '22 19:06 ditherized

Any solution?

I'm using react-native-bottom-sheet (https://github.com/gorhom/react-native-bottom-sheet). I had to downgrade react-native-gesture-handler to 1.10.3. Now it works.

Gfr1992 avatar Jun 07 '22 06:06 Gfr1992

It's hard to tell what's wrong exactly from the error message. A repository, or a list of steps to follow that would allow to reliably reproduce the issue would be greatly appreciated.

j-piasecki avatar Jun 08 '22 08:06 j-piasecki

+1 i was on 1.10.3, after upgrading, i've encounter this issue.

SectionTN avatar Jul 19 '22 17:07 SectionTN

can someone please close this issue as completed? i was facing the error until i updated to 2.5.0 of react-native-gesutre-handler, and i confirm this issue is solved in that version.

SectionTN avatar Jul 20 '22 22:07 SectionTN

Great, thank for the information!

j-piasecki avatar Jul 21 '22 07:07 j-piasecki

Any solution?

I'm using react-native-bottom-sheet (https://github.com/gorhom/react-native-bottom-sheet). I had to downgrade react-native-gesture-handler to 1.10.3. Now it works.

Its work for me, thanks

umairalirehan avatar Sep 15 '24 11:09 umairalirehan