项目级别的build.gradle,我正在使用最新版本的kotlin
错误:
C:/Users/hp/.gradle/caches/transforms-3/648640f83817e7438e3934ba83addfe2/transformed/jetified-play-services-measurement-api-22.0.1-api.jar!/META-INF/java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │
│ update D:\phone_auth\android\build.gradle: │
│ ext.kotlin_version = '<latest-version>' │
└────────────────────────────────────────────────────────────────────────────────────────────┘
Error: Gradle task assembleDebug failed with exit code 1
最近很常见的问题,可以在
settings.gradle
文件中调整kotlin版本。
你可以在android文件夹级别找到它,
android/settings.gradle
:
plugins {
id "org.jetbrains.kotlin.android" version "1.9.24" apply false
}
您可以从 here
跟踪 kotlin 的新版本