升级反应原生版本

Use*_*511 7 android upgrade android-studio react-native

将我的 React Native 版本从 0.63.3 升级到最新版本后,出现以下错误:

> Could not resolve all files for configuration ':classpath'.
   > Could not find com.facebook.react:react-native-gradle-plugin:.
     Required by:
         project :
Run Code Online (Sandbox Code Playgroud)

以下是我的 build.gradle 文件中的依赖项:

   dependencies {
        classpath("com.android.tools.build:gradle:7.0.4")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("de.undercouch:gradle-download-task:4.1.2")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
Run Code Online (Sandbox Code Playgroud)

有人能给我解释一下吗?如果您能提供帮助,我们将不胜感激!

Sea*_*ord 10

The github issue that @RamaProg suggested does provide some insight but it was in the context of building react-native from source. And i believe that issue was created before 0.68.1 was a stable public release.

Following the upgrade guide here: https://react-native-community.github.io/upgrade-helper/?from=0.67.4&to=0.68.1

Suggests the following addititons to settings.gradle:

includeBuild('../node_modules/react-native-gradle-plugin')
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
    include(":ReactAndroid")
    project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
}
Run Code Online (Sandbox Code Playgroud)

And this change is what resolved the issue for me.