React Native 0.76.7 Android构建失败:Kotlin版本不兼容求助
React Native 0.76.7 Android构建Kotlin版本不兼容问题
近日将React Native升级至0.76.7版本后,iOS版本可正常运行,但Android版本无法构建,持续遇到Kotlin版本不兼容错误:
e: file:///Users/marcelina/.gradle/caches/8.10.2/transforms/1258208f462649e4068633c595a67e2a/transformed/play-services-measurement-api-22.2.0-api.jar!/META-INF/java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0. e: file:///Users/marcelina/.gradle/caches/8.10.2/transforms/28d19078ed3a76b20e94df2c3463b9c5/transformed/play-services-measurement-impl-22.2.0-api.jar!/META-INF/java.com.google.android.gms.libs.filecompliance.proto_file_access_api_type_kt_proto_lite.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0. e: file:///Users/marcelina/.gradle/caches/8.10.2/transforms/28d19078ed3a76b20e94df2c3463b9c5/transformed/play-services-measurement-impl-22.2.0-api.jar!/META-INF/third_party.kotlin.protobuf.src.commonMain.kotlin.com.google.protobuf.kotlin_only_for_use_in_proto_generated_code_its_generator_and_tests.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0. e: file:///Users/marcelina/.gradle/caches/8.10.2/transforms/28d19078ed3a76b20e94df2c3463b9c5/transformed/play-services-measurement-impl-22.2.0-api.jar!/META-INF/third_party.kotlin.protobuf.src.commonMain.kotlin.com.google.protobuf.kotlin_shared_runtime.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
已尝试以下操作,但问题未解决:
- 重置缓存
- 执行
./gradlew clean - 重新安装node_modules
当前配置
项目根目录build.gradle
buildscript { ext { buildToolsVersion = "35.0.0" minSdkVersion = 24 compileSdkVersion = 35 targetSdkVersion = 34 ndkVersion = "26.1.10909125" kotlinVersion = "1.9.25" } repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle") classpath("com.facebook.react:react-native-gradle-plugin") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") classpath('com.google.gms:google-services:4.4.2') classpath('com.google.firebase:firebase-crashlytics-gradle:3.0.3') } } allprojects { repositories { maven { url("$rootDir/../node_modules/detox/Detox-android") } } } apply plugin: "com.facebook.react.rootproject"
gradle.properties
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m android.useAndroidX=true reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 newArchEnabled=true hermesEnabled=true
请问有没有人遇到过类似问题?
内容的提问来源于stack exchange,提问作者Marcelinka
相关产品推荐
相关产品推荐

