为Android构建时的本机错误 - 任务:React-Native-enter-Esture Handler:CompileLeaseKotlin失败

问题描述 投票:0回答:7
在构建分支的Android APK时,我面临的错误是。 (为iOS构建时不会发生)。自多年来以来,我在此代码库上一直在使用React-Native-Esture Handler,但从未遇到此错误。

在合并PR后,此错误开始发生,但该PR不包含任何Android侧面的本机更改。

version信息: 反应本机手柄: ^2.3.2 build.gradle中的kotlin版本:1.6.10 反应本版本: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.

试过此问题的流行解决方案,例如:

使用这个

    npm i jetifier npx jetify
  1. 这些已经存在于gradle中。
android.useAndroidX=true  
android.enableJetifier=true
    但仍然没有解决问题!
  1. 请共享任何解决方案或询问任何信息。这将非常有帮助。
uppating

android/build.gradle

sdk版本对我有用:

buildscript { ext { targetSdkVersion '33.0.0' buildToolsVersion = 33 compileSdkVersion = 33 } }
android react-native kotlin cross-platform react-native-gesture-handler
7个回答
9
投票

这个问题似乎到处都是。在软件包中必须有一个不匹配的版本导致此错误。您必须
update

您的整个项目并寻求破坏更改。
或在大多数情况下应降级到反应式的手机处理程序2.8.0
应该工作:

8
投票


我从以下方式更改它:

yarn add [email protected]

TO:

Build.VERSION_CODES.TIRAMISU

它起作用了

6
投票
在我的案子中,反应本机构造成了问题。

please尝试此版本。

“反应 - 势handler”:“ 2.9.0”
    

aupdating Android/build.gradle SDK版本对我有用:

Build.VERSION_CODES.LOLLIPOP


5
投票
ndkVersion = "25.0.8775105" buildscript { ext { targetSdkVersion '33.0.0' buildToolsVersion = 33 compileSdkVersion = 33 } }

可能会期待较旧的版本

react-navigation

,如果您更新一个版本,则需要两者更新。

这似乎是您的React本地版本之间的兼容性问题。我在

react-navigation

1
投票
react-native-gesture-handler

时使用了

"react-native": "0.71.17"
,遇到了问题。尝试各种解决方案后,我发现降级
"react-native-gesture-handler": "2.20.0"

0
投票
如果您仍面临类似的问题,请尝试以下步骤:

1.CHACKKOTLIN版本
确保您的项目使用正确的Kotlin版本。对于反应天然
react-native-gesture-handler to version 2.9.0
,通常建议使用kotlin
0.71.17

。更新您的

0
投票
文件以包括:

android/build.gradle
重建项目:

NPM安装 CD Android ./gradlew清洁 光盘 .. NPX反应原始运行android

	
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.