gpt4 book ai didi

android - 在 React Native 0.59 上将目标 sdk 升级到 29

转载 作者:行者123 更新时间:2023-12-03 16:27:43 43 4
gpt4 key购买 nike

我当前在 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

最佳答案

请按照以下步骤操作:-

  • 打开android/build.gradle在你的 React Native 项目中。
  • 然后增加 compileSdkVersiontargetSdkVersion值(value)观
    29 .

  • In 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 )。

  • 你应该准备好了。

    关于android - 在 React Native 0.59 上将目标 sdk 升级到 29,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63322851/

    43 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com