【问题标题】:React Native Android build failure with different errors without any changes in code for past days due to publish of React Native version 0.71.0-rc.0com.facebook.react:react-native:0.71.0-rc.0: - debugVariantDefaultRuntimePublication - releaseVariantDefaultRuntimePublication
【发布时间】:2022-11-06 15:59:02
【问题描述】:

错误:命令失败:./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE:构建失败并出现异常。

  • 其中:构建文件'/Users/....../node_modules/react-native-month-year-picker/android/build.gradle' 线路:115

  • 出了什么问题:配置项目“:react-native-month-year-picker”时出现问题。

无法解析配置“:react-native-month-year-picker:implementation”的所有文件。 无法解析 com.facebook.react:react-native:+。 要求: 项目:react-native-month-year-picker > 无法在 com.facebook.react:react-native:0.71.0-rc.0 的以下变体之间进行选择: - debugVariantDefaultRuntimePublication -releaseVariantDefaultRuntimePublication 它们都符合消费者属性: - 变体“debugVariantDefaultRuntimePublication”功能 com.facebook.react:react-native:0.71.0-rc.0: - 无与伦比的属性: - 提供 com.android.build.api.attributes.BuildTypeAttr 'debug' 但 消费者没有要求 - 提供 org.gradle.category 'library' 但消费者没有要求 - 提供 org.gradle.dependency.bundling 'external' 但消费者没有要求 - 提供 org.gradle.libraryelements 'aar' 但消费者没有要求 - 提供 org.gradle.status 'release' 但消费者没有要求 - 提供 org.gradle.usage 'java-runtime' 但消费者没有要求

【问题讨论】:

    标签: android react-native gradle


    【解决方案1】:

    将此修复添加到您的安卓->构建.gradle文件如下:

    buildscript {
        // ...
    }
    
    
    allprojects {
        repositories {
           exclusiveContent {
               filter {
                   includeGroup "com.facebook.react"
               }
               forRepository {
                   maven {
                       url "$rootDir/../node_modules/react-native/android"
                   }
               }
           }
            // ...
        }
    }
    

    此修复程序将应用 exclusiveContent 解析规则,该规则将强制 React Native Android 库的解析,以使用 node_modules 中的那个

    参考:Fix and updates on Android build failures happening since Nov 4th 2022 #35210

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-01-03
      • 2023-01-30
      • 2016-12-15
      • 2022-07-12
      • 2022-01-23
      • 2022-06-19
      • 1970-01-01
      • 2023-01-30
      相关资源
      最近更新 更多