【问题标题】:Upgrading target sdk to 29 on React Native 0.59在 React Native 0.59 上将目标 sdk 升级到 29
【发布时间】:2020-11-29 00:49:08
【问题描述】:

我当前在 React Native 上的 android target sdk 是 28,但 Play Store 显示将其更新到 29。 于是我在 android/build.gradle 中做了如下改动

buildscript {

    ext {
       googlePlayServicesVersion = "16.0.0"
        firebaseVersion = "17.3.4"
        buildToolsVersion = "28.0.3" //changed to 29.0.3
        minSdkVersion = 16
        compileSdkVersion = 28 //changed to 29
        targetSdkVersion = 28 // changed to 29
        supportLibVersion = "28.0.0"
    }
}

但是现在当我运行 npx react-native run-android 我得到以下错误。

Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.android.support:support-v4:29.0.0.
  Required by:
      project :app
      project :app > project :react-native-firebase
> Could not find com.android.support:support-v4:29.0.0.
  Required by:
      project :app > com.google.android.gms:play-services-basement:16.2.0

我正在使用 react-native-firebase v5

【问题讨论】:

  • 这方面有什么更新吗?在这里遇到同样的问题
  • 您正在使用 supportLibVersion = "28.0.0" 将其更改为 29.0.0。如果它仍然显示错误而不是添加 29 的可用版本
  • 没有支持库 29.需要迁移到androidX。

标签: android firebase react-native sdk react-native-firebase


【解决方案1】:

按照以下步骤操作:-

  • 在您的 React Native 项目中打开 android/build.gradle
  • 然后递增compileSdkVersiontargetSdkVersion 值 致29

android/build.gradle

   buildscript {
       ext {
           buildToolsVersion = "28.0.3"
           minSdkVersion = 16
           compileSdkVersion = 29
           targetSdkVersion = 29
       }
       // ...
   }

   allprojects {
    // ...
   }
  • 然后在 Android Studio 中,运行“使用 Gradle 文件同步项目”(File > Sync Project with Gradle Files)。

你应该准备好了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-11-07
    • 2020-05-21
    • 2019-11-10
    • 1970-01-01
    • 2021-06-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多