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
相关产品推荐
相关产品推荐

