React Native error while building for android - Task :react-native-gesture-handler:compileReleaseKotlin FAILED
Asked Answered
N

6

13

Here is the error I'm facing while building the android apk of a branch. (does not happen while building for ios). I have been using react-native-gesture-handler since years on this codebase but never faced this error.

This error started occuring after a pr was merged, but this pr does not contain any android side native change.

Version Info : react-native-gesture-handler: ^2.3.2 kotlin version in build.gradle: 1.6.10 react-native version: 0.68.5

> Task :react-native-gesture-handler:compileReleaseKotlin FAILED
e: /Users/saumya/Desktop/latest/lc-app/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt: (247, 92): Unresolved reference: TIRAMISU

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-gesture-handler:compileReleaseKotlin'.
> Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

Have tried popular solutions for this issue like :

  1. using this
npm i jetifier
npx jetify
  1. these are already present in gradle.properties :
android.useAndroidX=true  
android.enableJetifier=true

but still the issue is not getting solved!

Please share any solutions or ask any info . It will be super helpful.

Nevski answered 18/5, 2023 at 11:54 Comment(2)
May be some version mismatch issue or else you need to update kotlinVersion. Please check if this helps : github.com/software-mansion/react-native-gesture-handler/issues/…Acuna
What are the values of complileSdkVersion and targerSdkVersion in build.gradle?Zilla
G
9

Updating android/build.gradle sdk versions works for me:

buildscript {
  ext {
    targetSdkVersion  '33.0.0'
    buildToolsVersion = 33
    compileSdkVersion = 33
  }
}
Genera answered 5/6, 2023 at 20:23 Comment(3)
Careful with this! I recommend only updating this when instructed to by a react-native upgrade.. Once I did this manually, and I broke the build for like half of our Android users (it worked fine on the android device I test on) Lesson learned..Murcia
what is react-native-gesture-handler version?Blakeley
"react-native-gesture-handler": "^2.8.0"Genera
N
8

This react-native-gesture-handler issue seems to be popping up everywhere. There must be a version mismatch in the packages that is leading to this error. You'll have to update your entire project and look for breaking changes.

Or, downgrading to react-native-gesture-handler to version 2.8.0 should work in most cases: yarn add [email protected]

Nth answered 24/5, 2023 at 7:48 Comment(0)
H
6

I change it from:

Build.VERSION_CODES.TIRAMISU

to:

Build.VERSION_CODES.LOLLIPOP

and it worked.

Heterotrophic answered 22/5, 2023 at 21:12 Comment(0)
K
4

In my case, react-native-gesture-handler caused issue.

Please try this version.

"react-native-gesture-handler": "2.9.0"

Kame answered 19/5, 2023 at 15:36 Comment(0)
G
1

Updating android/build.gradle sdk versions works for me:

ndkVersion = "25.0.8775105"

buildscript {
  ext {
    targetSdkVersion  '33.0.0'
    buildToolsVersion = 33
    compileSdkVersion = 33
  }
}
Gusto answered 21/6, 2023 at 8:29 Comment(2)
what is your react-native-gesture-handler version?Blakeley
@Blakeley it was "^2.12.0"Gusto
P
0

If you are using react-navigation it's possible that react-navigation is expecting an older version of react-native-gesture-handler and if you update one you will need to update both.

Plume answered 28/6, 2023 at 21:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.