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

Task :react-native-gesture-handler:compileDebugKotlin FAILED RN 0.69.3 with new arch

Open farell-flip opened this issue 1 year ago • 11 comments

Description

When I build my app its failed with this errors:

Task :react-native-gesture-handler:compileDebugKotlin FAILED
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (28, 40): Unresolved reference: RNGestureHandlerButtonManagerDelegate
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (29, 40): Unresolved reference: RNGestureHandlerButtonManagerInterface
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (34, 80): Unresolved reference: RNGestureHandlerButtonManagerInterface
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (38, 19): Unresolved reference: RNGestureHandlerButtonManagerDelegate
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (47, 3): 'setForeground' overrides nothing
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (52, 3): 'setBorderless' overrides nothing
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (57, 3): 'setEnabled' overrides nothing
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (67, 3): 'setRippleColor' overrides nothing
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (72, 3): 'setRippleRadius' overrides nothing
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (77, 3): 'setExclusive' overrides nothing
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (82, 3): 'setTouchSoundDisabled' overrides nothing
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt: (7, 40): Unresolved reference: RNGestureHandlerRootViewManagerDelegate
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt: (8, 40): Unresolved reference: RNGestureHandlerRootViewManagerInterface
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt: (17, 3): Unresolved reference: RNGestureHandlerRootViewManagerInterface
e: /Users/myname/Desktop/my-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.kt: (21, 17): Unresolved reference: RNGestureHandlerRootViewManagerDelegate
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions

It works fine with new arch disabled, but failed when I enable it.

Steps to reproduce

  1. Enable new arch
  2. Clean the project
  3. Build the app (Android)

Snack or a link to a repository

Not needed

Gesture Handler version

2.5.0

React Native version

0.69.3

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

No response

Device model

No response

Acknowledgements

Yes

farell-flip avatar Aug 12 '22 08:08 farell-flip

Hey! 👋

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

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

github-actions[bot] avatar Aug 12 '22 08:08 github-actions[bot]

+1

JordyMota avatar Aug 12 '22 19:08 JordyMota

+2

ocharlespereira avatar Aug 22 '22 21:08 ocharlespereira

+3

levizimmerman avatar Aug 23 '22 14:08 levizimmerman

+4

zhangfuchao avatar Aug 27 '22 11:08 zhangfuchao

It seems like codegen doesn't generate files for Gesture Handler. It would be grate if you could provide a repository with a reproduction or a more detailed list of steps to reproduce it. When I tried clean & build on a new app after installing Gesture Handler and enabling the new architecture, it worked correctly for me.

j-piasecki avatar Aug 29 '22 10:08 j-piasecki

+5 => 0.69.4

azizmobarak avatar Aug 29 '22 15:08 azizmobarak

After upgrade to new RN and turn on new arch, I got the same issue. I need to clean up my settings.gradle, build.gradle, app/build.gradle following current version setup from RN repository to build succesfully.

I'm using:

react-native: "0.69.5" // (I try "0.69.4" and still works)
react-native-gesture-handler: "2.5.0"

and somehow i need to upgrade:

react-native-codegen: "^0.0.13"

I remove manual linking on settings.gradle since they already linked from build/generated/rncli/../PackageList.java

I also add kotlinVersion to build.gradle and remove classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" if any to avoid duplicate.

buildscript {
...
    ext {
        kotlinVersion = '1.6.10'
...
    }
}
...

For addition I found issue Android.mk:Build command failed and end up to fix other issue by setting org.gradle.parallel=false on gradle.properties.

bukhari-flip avatar Aug 30 '22 03:08 bukhari-flip

I'm getting the same error with Gesture Handler version 2.6.2

React Native version 0.70.1

sgabriel avatar Sep 26 '22 11:09 sgabriel

I got the same error too

mohamed2m2018 avatar Sep 27 '22 19:09 mohamed2m2018

Have you tried the advice from @bukhari-flip? Mainly, updating settings.gradle, build.gradle, app/build.gradle to reflect the recent changes from the template and upgrading the react-native-codegen?

If it doesn't help, could you provide a link to a repository with an app that would allow to consistently reproduce it?

j-piasecki avatar Oct 03 '22 06:10 j-piasecki

got this error too, any fix?

androxxe avatar Oct 24 '22 10:10 androxxe

If the new arch is enabled I got the same issue on 0.69 , I see no fix on 70 too I guess

azizmobarak avatar Oct 24 '22 13:10 azizmobarak

Yeah, the same issue. react-native v0.69.5 react-native-gesture-handler v2.7.1

Melber17 avatar Oct 26 '22 07:10 Melber17

I upgraded the kotlin version,fixed it。 Chinese translation into English, I hope you can understand

zhangfuchao avatar Oct 26 '22 07:10 zhangfuchao

@zhangfuchao which version are you using ?

nazrdogan avatar Oct 26 '22 12:10 nazrdogan

@nazrdogan kotlin_version:1.4.10 react-native-gesture-handler:2.6.0 react-native:0.64.2

zhangfuchao avatar Oct 27 '22 02:10 zhangfuchao

@nazrdogan kotlin_version:1.4.10 react-native-gesture-handler:2.6.0 react-native:0.64.2

the problem is related to the react native version

Melber17 avatar Nov 03 '22 11:11 Melber17

+6

dibyopra avatar Nov 08 '22 09:11 dibyopra

+6 I changed my kotlin version to kotlin_version = "1.5.31" in android/build.gradle this fix my issues

dibyopra avatar Nov 08 '22 14:11 dibyopra

So I solved it by

  1. changing kotlinVersion = "1.4.10" to kotlinVersion = "1.5.20" in my android/build.gradle
  2. Also upgraded react native gesture to "react-native-gesture-handler": "^2.8.0",

codekojo avatar Nov 08 '22 15:11 codekojo

Same problem with android and enabled new architecture kotlin_version: 1.6.10 react-native-gesture-handler: 2.8.0 react-native: 0.70.5

e: /Users/andreibehel/Projects/mobile/node_modules/react-native-gesture-handler/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt: (5, 22): Unresolved reference: reanimated e: /Users/andreibehel/Projects/mobile/node_modules/react-native-gesture-handler/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt: (8, 33): Unresolved reference: ReanimatedModule e: /Users/andreibehel/Projects/mobile/node_modules/react-native-gesture-handler/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt: (12, 50): Not enough information to infer type variable T e: /Users/andreibehel/Projects/mobile/node_modules/react-native-gesture-handler/android/reanimated/src/main/java/com/swmansion/gesturehandler/ReanimatedEventDispatcher.kt: (12, 66): Unresolved reference: ReanimatedModule e: /Users/andreibehel/Projects/mobile/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt: (18, 22): Unresolved reference: common e: /Users/andreibehel/Projects/mobile/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt: (41, 45): Unresolved reference: GestureHandlerStateManager e: /Users/andreibehel/Projects/mobile/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt: (432, 3): 'setGestureHandlerState' overrides nothing

AndreiBehel avatar Nov 10 '22 14:11 AndreiBehel

@j-piasecki Ok I've found that after adding reanimated 2.12 to the sample RN-0.70.5 project with gesture-handler 2.8.0, I got failing build. So should reanimated@next be used instead of stable 2.12?

AndreiBehel avatar Nov 11 '22 10:11 AndreiBehel

yarn add react-native-reanimated@next solved the building problem

AndreiBehel avatar Nov 11 '22 14:11 AndreiBehel

The problem is in react-native-gesture-handler library.

"react-native": "0.70.5", "react-native-reanimated": "^3.0.0-rc.4", "react-native-gesture-handler": "^2.8.0",

image

Melber17 avatar Nov 12 '22 07:11 Melber17

Fixed this issue by removing kotlinVersion = '1.6.10' & classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:.6.10"

AdhamMahmoud98 avatar Nov 15 '22 10:11 AdhamMahmoud98

+7 I'm getting the same error with Gesture Handler version: 2.2.1

React Native version: 0.68.2

JorgeArmandoMT avatar Nov 24 '22 07:11 JorgeArmandoMT

+7 I'm getting the same error with Gesture Handler version: 2.2.1

React Native version: 0.68.2

After trying different ways, you can finally fix it by updating to expo sdk 47 and expo dev-client 2.0.1 and update react-native-gesture-handler to 2.8.0 version.

also install expo-build-properties and add the following properties:

"compileSdkVersion": 33, "targetSdkVersion": 33, "buildToolsVersion": "30.0.2", "KotlinVersion": "1.7.10"

Good luck.

JorgeArmandoMT avatar Nov 25 '22 06:11 JorgeArmandoMT

+7 I'm getting the same error with Gesture Handler version: 2.2.1 React Native version: 0.68.2

After trying different ways, you can finally fix it by updating to expo sdk 47 and expo dev-client 2.0.1 and update react-native-gesture-handler to 2.8.0 version.

also install expo-build-properties and add the following properties:

"compileSdkVersion": 33, "targetSdkVersion": 33, "buildToolsVersion": "30.0.2", "KotlinVersion": "1.7.10"

Good luck.

What about CLI?

Melber17 avatar Nov 25 '22 08:11 Melber17

Can you try changing this line in Gesture Handler's build.gradle to

srcDirs += ['src/fabric/java', 'build/generated/source/codegen/java']

j-piasecki avatar Nov 28 '22 07:11 j-piasecki