【问题标题】:React Native Android needs to target API level 29 before November 2, 2020React Native Android 需要在 2020 年 11 月 2 日之前针对 API 级别 29
【发布时间】:2020-07-27 08:57:51
【问题描述】:

根据新的 Google Play 政策,所有应用必须在 2020 年 11 月 2 日之前至少面向 Android 10 (API 29)。

更多信息:https://developer.android.com/distribute/play-policies

从今天开始,React Native 的目标是 API 28(v0.63),是否有更新目标 SDK 版本的计划?

【问题讨论】:

  • 其实RN v63.0支持sdk 29版本。看这个changelog
  • @firats 在更新日志中,没有任何关于将targetSdk 提升到 29 的内容。只有“将 Android 构建工具提升到 29.0.2,compileSdk 到 29”,但这是不同的
  • @matusalem 很好.. 无论如何它都支持。 Here is the main issue about the topic
  • @firats,好吧,你是对的。在我启动一个新的 RN 项目后,我注意到 build.gradle 中的 targetSdk=29

标签: android react-native google-play


【解决方案1】:

在您的 React Native 项目中打开 android/build.gradle 并将 compileSdkVersion 和 targetSdkVersion 值更改为 29。

android/build.gradle

buildscript {
ext {
    buildToolsVersion = "29.0.5"
    minSdkVersion = 16
    compileSdkVersion = 29
    targetSdkVersion = 29
}
}

然后进入 Android Studio 并运行“与文件系统同步项目”(文件 > 与 Gradle 文件同步项目)。

【讨论】:

    【解决方案2】:

    有必要升级你的 React Native 版本。可以看说明here

    一个简单的 cli 升级对我有用:

    npx react-native upgrade
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多