首页 > 解决方案 > Flutter:任务':cloud_firestore:extractDebugAnnotations'的执行失败

问题描述

我正在使用 Firebase 构建一个带有颤振的聊天应用程序,现在我处于使用 Cloudfirestore 发送和接收消息的水平。该代码没有任何错误,并且在我尝试运行该项目时,它在将 Flutter 升级到 2.5.0 之前一直在工作,但遇到了我无法修复的错误:

Execution failed for task ':cloud_firestore:extractDebugAnnotations'.
> Could not resolve all files for configuration ':cloud_firestore:lintClassPath'.
   > Could not find kotlin-compiler-30.0.0.jar (com.android.tools.external.com-intellij:kotlin-compiler:30.0.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/30.0.0/kotlin-compiler-30.0.0.jar

pubspec.yaml 中的依赖项:

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  animated_text_kit: ^4.2.1
  firebase_core: ^1.6.0
  firebase_auth: ^3.1.1
  cloud_firestore: ^2.5.2
  modal_progress_hud: ^0.1.3

这是android/build.gradle:

buildscript {
    ext.kotlin_version = '1.5.30'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.10'
    }
}
allprojects {
    repositories {
        google()
        jcenter()
    }
}
rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

这是应用程序/build.gradle:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 30
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
    defaultConfig {
        applicationId "com.example.flash_chat"
        minSdkVersion 16
        targetSdkVersion 30
        multiDexEnabled = true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:28.4.0')
    implementation 'com.google.firebase:firebase-analytics-ktx'
}

标签: androidflutterkotlindartgradle

解决方案


推荐阅读