我从 Git 中提取了一个用 Flutter 制作的团队项目,出于某种原因,在构建应用程序时(在 Android Studio 中按下绿色箭头并运行 main.dart),我收到以下消息:
What went wrong:
Execution failed for task ':biometric_storage:kaptGenerateStubsDebugKotlin'.
> Could not resolve all files for configuration ':biometric_storage:kapt'.
> Failed to transform moshi-1.13.0.jar (com.squareup.moshi:moshi:1.13.0) to match attributes {artifactType=processed-jar, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.environment=standard-jvm, org.gradle.jvm.version=8, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
> Execution failed for JetifyTransform: C:\Users\UserName\.gradle\caches\modules-2\files-2.1\com.squareup.moshi\moshi\1.13.0\da685586facab9eb5c4fb630ce248be14e7da21b\moshi-1.13.0.jar.
> Failed to transform 'C:\Users\UserName\.gradle\caches\modules-2\files-2.1\com.squareup.moshi\moshi\1.13.0\da685586facab9eb5c4fb630ce248be14e7da21b\moshi-1.13.0.jar' using Jetifier. Reason: Unsupported class file major version 60. (Run with --stacktrace for more details.)
我的 build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
classpath 'com.google.gms:google-services:4.3.5'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext.kotlin_version = '1.4.31'
我的 gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
其他可能相关的信息
Fluter Android Studio plugin 63.2.1
Dart Android Studio plugin 203.8452
Dart 2.15.1
Flutter 2.8.1
我的团队中没有人收到此消息,因此我怀疑这与某些本地配置差异有关,或者我可能有某些程序的不同版本。另外,我无法更新 Gradle,因为这会导致一些其他问题。编辑:清除所有队友的缓存后,出现此错误。