You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native Android编译失败:react-native-navigation找不到符号错误

解决React Native Android编译错误:cannot find symbol .setUIImplementationProvider()

问题详情

执行react-native run-android或./gradlew bundleRelease编译Android构建包时持续失败,但iOS端运行正常,且未修改过Android相关代码。具体错误信息如下:

Task :react-native-navigation:compileReactNative68DebugJavaWithJavac FAILED
/Users/xxxxxx/Documents/Github/YourProjectName/node_modules/react-native-navigation/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/NavigationReactNativeHost.java: error: cannot find symbol
.setUIImplementationProvider(getUIImplementationProvider())

当前环境:React Native版本0.68.2,Kotlin版本1.6(也曾尝试1.4.31),已尝试Stack Overflow及GitHub仓库中的常规解决方案。

解决方案

在项目的android/build.gradle文件中添加以下配置:

exclusiveContent {
           // We get React Native's Android binaries exclusively through npm,
           // from a local Maven repo inside node_modules/react-native/.
           // (The use of exclusiveContent prevents looking elsewhere like Maven Central
           // and potentially getting a wrong version.)
           filter {
               includeGroup "com.facebook.react"
           }
           forRepository {
               maven {
                   url "$rootDir/../node_modules/react-native/android"
               }
           }
       }

相关问题

该问题与GitHub上的#35210和#7630问题相关。


内容的提问来源于stack exchange,提问作者Stian Instebo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 13:20:31