buildscript { ext { buildToolsVersion = "34.0.0" minSdkVersion = 23 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "26.1.10909125" kotlinVersion = "1.9.22" // 添加 Android Gradle Plugin 版本 androidGradlePluginVersion = '8.1.1' // 使用与 Gradle 8.x 兼容的版本 } repositories { google() mavenCentral() maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } } dependencies { // 指定具体版本 classpath("com.android.tools.build:gradle:${androidGradlePluginVersion}") classpath("com.facebook.react:react-native-gradle-plugin") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") } } allprojects { repositories { maven { // React Native 预构建的 Maven 仓库 url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC 的备用 Maven 仓库 url("$rootDir/../node_modules/jsc-android/dist") } // 阿里云镜像 maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } mavenCentral { // 排除旧版本的 react-native content { excludeGroup "com.facebook.react" } } google() maven { url 'https://www.jitpack.io' } } } apply plugin: "com.facebook.react.rootproject"