Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
farell-flip opened this issue Aug 12, 2022 · 57 comments
Labels
Missing repro Platform: Android This issue is specific to Android

Comments

@farell-flip
Copy link

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

@github-actions
Copy link

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 github-actions bot added the Platform: Android This issue is specific to Android label Aug 12, 2022
@JordyMota
Copy link

+1

@ocharlespereira
Copy link

+2

@levizimmerman
Copy link

+3

@zhangfuchao
Copy link

+4

@j-piasecki
Copy link
Member

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.

@azizmobarak
Copy link

+5 => 0.69.4

@bukhari-flip
Copy link

bukhari-flip commented Aug 30, 2022

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.

@j-piasecki j-piasecki added the Close when stale The issue will be closed automatically if it remains inactive label Sep 21, 2022
@sgabriel
Copy link

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

React Native version
0.70.1

@github-actions github-actions bot removed the Close when stale The issue will be closed automatically if it remains inactive label Sep 26, 2022
@mohamed2m2018
Copy link

I got the same error too

@j-piasecki
Copy link
Member

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?

@androxxe
Copy link

got this error too, any fix?

@azizmobarak
Copy link

azizmobarak commented Oct 24, 2022

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

@EugeniuszX
Copy link

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

@zhangfuchao
Copy link

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

@nazrdogan
Copy link

@zhangfuchao which version are you using ?

@zhangfuchao
Copy link

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

@EugeniuszX
Copy link

@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

@dibyopra
Copy link

dibyopra commented Nov 8, 2022

+6

@dibyopra
Copy link

dibyopra commented Nov 8, 2022

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

@codekojo
Copy link

codekojo commented Nov 8, 2022

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",

@AndreiBehel
Copy link

AndreiBehel commented Nov 10, 2022

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
Copy link

AndreiBehel commented Nov 11, 2022

@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
Copy link

AndreiBehel commented Nov 11, 2022

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

@EugeniuszX
Copy link

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

@AdhamMahmoud98
Copy link

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

@heroic
Copy link

heroic commented Nov 28, 2022

@j-piasecki this didn't work

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

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

@heroic
Copy link

heroic commented Nov 29, 2022

for anyone looking for a repro, here are the steps:

  • expo init. SDK 47
  • yarn prebuild
  • set newArchEnabled=true in android/gradle.properties
  • install gesture handler and reanimated. versions: 2.8.0 and 2.12.0 respectively.
  • yarn android

@heroic
Copy link

heroic commented Nov 29, 2022

@heroic
Copy link

heroic commented Dec 1, 2022

@j-piasecki any solution here?

@j-piasecki
Copy link
Member

@heroic Are you sure it's the same issue? In your repro it seems like Reanimated's package is not picked up during build, which persists after removing Gesture Handler. In this case I believe the GH build fails first because it picks up that Reanimated is in node_modules so it tries to include it, as some code is shared between the libraries, but fails because it cannot find it.

@heroic
Copy link

heroic commented Dec 1, 2022

Not sure, but the error log appears to be the same

@heroic
Copy link

heroic commented Dec 12, 2022

@j-piasecki were you able to check this? Any thing that you can share, that may help me check further into what to tinker?

@j-piasecki
Copy link
Member

@heroic I believe it's caused by Reanimated 2.x.x which doesn't support fabric, on the new architecture you should be using Reanimated 3 (3.0.0-rc.8 is the newest at the moment). Here's more information about it.

@muhammeddeniz
Copy link

this solved my problem
in android/build.gradle

 ext {
        kotlinVersion = "1.6.0"
        ...
}

 dependencies {
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0'
        ...
} 

@blueromans
Copy link

+8
I'm getting the same error with
Gesture Handler version: 2.3.0

React Native version: 0.70.6

@gulsher7
Copy link

+9
any solution ?

@savio777
Copy link

savio777 commented Feb 1, 2023

this solved my problem in android/build.gradle

 ext {
        kotlinVersion = "1.6.0"
        ...
}

 dependencies {
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0'
        ...
} 

with me it worked.

  • package.json
    "react": "18.2.0",
    "react-native": "0.71.1",
    "react-native-gesture-handler": "^2.9.0",
  • android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33
        googlePlayServicesVersion = "17.0.0"

        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"

        kotlinVersion = "1.6.0"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.3.1")
        classpath("com.facebook.react:react-native-gradle-plugin")

        classpath 'com.google.gms:google-services:4.3.14'

        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0'
    }
}

@j-piasecki j-piasecki added the Close when stale The issue will be closed automatically if it remains inactive label Feb 27, 2023
@buschco
Copy link

buschco commented Feb 27, 2023

@heroic I believe it's caused by Reanimated 2.x.x which doesn't support fabric, on the new architecture you should be using Reanimated 3 (3.0.0-rc.8 is the newest at the moment). Here's more information about it.

So if I remove react-native-reanimated from my package.json it should work and if I want to have react-native-reanimated I have to use at least 3.0.0-rc.8?

@github-actions github-actions bot removed the Close when stale The issue will be closed automatically if it remains inactive label Feb 27, 2023
@j-piasecki
Copy link
Member

I cannot say whether your app will work after removing react-native-reanimated but if you're using the new architecture then you should be using the most recent release of Reanimated 3.

@nibaji
Copy link

nibaji commented Mar 22, 2023

react-native-reanimated: 3.0.2 is available with fabric support

@anthlasserre
Copy link

anthlasserre commented May 14, 2023

Hey all 👋🏼
Apparently, that was related to my SDK & Tools versions. I've upgraded from 32 to 33 and all was sorted.

// android/build.gradle
buildscript {
  ext {
    buildToolsVersion = 33
    compileSdkVersion = 33
    targetSdkVersion  '33.0.0'
  }
}

@alejodelosrios
Copy link

alejodelosrios commented May 16, 2023

Hi guys.

React native : 0.71.8

For me what worked was:

  1. android/app/build.gradle

apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions'

  1. android/build.gradle

ext { kotlinVersion = '1.6.20' compileSdkVersion = 33 }

dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlinVersion" }

  1. android/settings.gradle

include ':react-native-gesture-handler' project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')

@sureco-doug
Copy link

Hi guys.

React native : 0.71.8

For me what worked was:

  1. android/app/build.gradle

apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions'

  1. android/build.gradle

ext { kotlinVersion = '1.6.20' compileSdkVersion = 33 }

dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlinVersion" }

  1. android/settings.gradle

include ':react-native-gesture-handler' project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')

@alejodelosrios 's solution worked for me!

@atefwahab
Copy link

Hey all 👋🏼 Apparently, that was related to my SDK & Tools versions. I've upgraded from 32 to 33 and all was sorted.

// android/build.gradle
buildscript {
  ext {
    buildToolsVersion = 33
    compileSdkVersion = 33
    targetSdkVersion  '33.0.0'
  }
}

It worked for me to

@j-piasecki
Copy link
Member

I'll close the issue since it seems like you've found the solution.

@Impesud
Copy link

Impesud commented May 26, 2023

+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.

This worked for me. Thank you.

    buildToolsVersion = "31.0.0"
    minSdkVersion = 24
    compileSdkVersion = 33
    targetSdkVersion = 33
    kotlinVersion = "1.7.10"

@Muhiddin2007
Copy link

Hey all 👋🏼 Apparently, that was related to my SDK & Tools versions. I've upgraded from 32 to 33 and all was sorted.

// android/build.gradle
buildscript {
  ext {
    buildToolsVersion = 33
    compileSdkVersion = 33
    targetSdkVersion  '33.0.0'
  }
}

thanks, it work for me too

@kapilavaiya
Copy link

kapilavaiya commented Jun 15, 2023

// android/build.gradle - updating the version change worked for me

buildscript {
    ext {
 buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33
        kotlinVersion = '1.6.10'
 }       
}

@Pandit2903
Copy link

// in android/build.gradle
buildscript {
ext {
buildToolsVersion = 33
compileSdkVersion = 33
targetSdkVersion '33.0.0'
}
}

this work for me

@tyson90
Copy link

tyson90 commented Jul 14, 2023

In my case helped just update kotlin version in android/build.gradle:

buildscript {
    ext {
        kotlinVersion = "1.7.10"
        ...

@mibrahim2001
Copy link

mibrahim2001 commented Jul 17, 2023

I solved it by upgrading my react-native-gesture-handler to version 2.9.0.

  1. Update package.json:
    Open your project's package.json file and find the dependency for react-native-gesture-handler. Change the version number to "2.9.0". It should look like this:
"dependencies": {
  "react-native-gesture-handler": "2.9.0",
  // other dependencies...
}
  1. Uninstall node_modules folder.

  2. npm install

  3. Try building your project now

@Gopal459
Copy link

// android/build.gradle - updating the version change worked for me

buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
kotlinVersion = '1.6.10'
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro Platform: Android This issue is specific to Android
Projects
None yet
Development

No branches or pull requests