react-native 2022.11.4号开始打包失败问题The minCompileSdk (31) specified in a is greater than this module‘s

react-native 2022.11.4号开始打包失败问题

  • 错误信息如下
* What went wrong:
Execution failed for task ':app:checkReleaseAarMetadata'.
> Multiple task action failures occurred:
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
      > The minCompileSdk (31) specified in a
        dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
        is greater than this module's compileSdkVersion (android-29).
        Dependency: androidx.appcompat:appcompat:1.4.1.
        AAR metadata file: /Users/windows/.gradle/caches/transforms-2/files-2.1/59edff95b28aac4602de9bd7b095e476/appcompat-1.4.1/META-INF/com/android/build/gradle/aar-metadata.properties.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
      > The minCompileSdk (31) specified in a
        dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
        is greater than this module's compileSdkVersion (android-29).
        Dependency: androidx.appcompat:appcompat-resources:1.4.1.
        AAR metadata file: /Users/windows/.gradle/caches/transforms-2/files-2.1/5eca708b3b532e9daeb3d43f167c7531/jetified-appcompat-resources-1.4.1/META-INF/com/android/build/gradle/aar-metadata.properties.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
      > The minCompileSdk (31) specified in a
        dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
        is greater than this module's compileSdkVersion (android-29).
        Dependency: androidx.emoji2:emoji2-views-helper:1.0.0.
        AAR metadata file: /Users/windows/.gradle/caches/transforms-2/files-2.1/ca4a76d2c3f18d70820ed26335d69838/jetified-emoji2-views-helper-1.0.0/META-INF/com/android/build/gradle/aar-metadata.properties.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
      > The minCompileSdk (31) specified in a
        dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
        is greater than this module's compileSdkVersion (android-29).
        Dependency: androidx.emoji2:emoji2:1.0.0.
        AAR metadata file: /Users/windows/.gradle/caches/transforms-2/files-2.1/9eefc2161c1faa4e75c6e993b8f3ebe8/jetified-emoji2-1.0.0/META-INF/com/android/build/gradle/aar-metadata.properties.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
      > The minCompileSdk (31) specified in a
        dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
        is greater than this module's compileSdkVersion (android-29).
        Dependency: androidx.lifecycle:lifecycle-process:2.4.0.
        AAR metadata file: /Users/windows/.gradle/caches/transforms-2/files-2.1/d546129225562ffaf8f872a77e9c25bc/jetified-lifecycle-process-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
      > The minCompileSdk (31) specified in a
        dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
        is greater than this module's compileSdkVersion (android-29).
        Dependency: androidx.tracing:tracing:1.1.0.
        AAR metadata file: /Users/windows/.gradle/caches/transforms-2/files-2.1/cf730d8026c953ae8833984b6e09027f/jetified-tracing-1.1.0/META-INF/com/android/build/gradle/aar-metadata.properties.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
      > The minCompileSdk (31) specified in a
        dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
        is greater than this module's compileSdkVersion (android-29).
        Dependency: androidx.core:core:1.7.0.
        AAR metadata file: /Users/windows/.gradle/caches/transforms-2/files-2.1/96f4429105cb0d56c8d0240cb95629c0/core-1.7.0/META-INF/com/android/build/gradle/aar-metadata.properties.
   > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
      > The minCompileSdk (31) specified in a
        dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
        is greater than this module's compileSdkVersion (android-29).
        Dependency: androidx.lifecycle:lifecycle-runtime:2.4.0.
        AAR metadata file: /Users/windows/.gradle/caches/transforms-2/files-2.1/48b27669722b644e756b061254d5d2c9/lifecycle-runtime-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.

原因:

官方发布 0.71-rc.0 版本,导致 0.71以下版本编译报错

解决方案

0.63以上升级到当前版本的最新小版本:

0.70.5
0.69.7
0.68.5
0.67.5
0.66.5
0.65.3
0.64.4
0.63.5

0.63 以下编辑 android/build.gralde 文件,添加如下代码

+ def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
+    configurations.all {
+        resolutionStrategy {
+            // Remove this override in 0.65+, as a proper fix is included in react-native itself.
+            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
+        }
+    }
}

原文: https://blog.csdn.net/qq_38545425/article/details/127792793
参考:https://github.com/reactnativecn/react-native-website/issues/660

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值