任务 ':path_provider:extractDebugAnnotations' 执行失败

Posted

技术标签:

【中文标题】任务 \':path_provider:extractDebugAnnotations\' 执行失败【英文标题】:Execution failed for task ':path_provider:extractDebugAnnotations'任务 ':path_provider:extractDebugAnnotations' 执行失败 【发布时间】:2020-06-27 09:23:04 【问题描述】:

我最近更新了 android studio 和 flutter(android studio 版本 3.6.1 和 flutter SDK v1.12.13+hotfix.8)。当我尝试运行我以前的项目时,我遇到了以下错误

Launching lib\main.dart on Google Nexus 5 0 in debug mode...
Running Gradle task 'assembleDebug'...


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':path_provider:extractDebugAnnotations'.
> Could not resolve all files for configuration ':path_provider:lintClassPath'.
   > Could not find lint-gradle.jar (com.android.tools.lint:lint-gradle:26.5.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle/26.5.0/lint-gradle-26.5.0.jar
   > Could not find lint.jar (com.android.tools.lint:lint:26.5.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint/26.5.0/lint-26.5.0.jar
   > Could not find lint-checks.jar (com.android.tools.lint:lint-checks:26.5.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-checks/26.5.0/lint-checks-26.5.0.jar
   > Could not find lint-api.jar (com.android.tools.lint:lint-api:26.5.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-api/26.5.0/lint-api-26.5.0.jar
   > Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.5.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/intellij-core/26.5.0/intellij-core-26.5.0.jar
   > Could not find kotlin-compiler.jar (com.android.tools.external.com-intellij:kotlin-compiler:26.5.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.5.0/kotlin-compiler-26.5.0.jar
   > Could not find uast.jar (com.android.tools.external.org-jetbrains:uast:26.5.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/external/org-jetbrains/uast/26.5.0/uast-26.5.0.jar

* 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 22s
Finished with error: Gradle task assembleDebug failed with exit code 1

这是pubspec.yaml 文件

name: someproject
description: A new Flutter application.

version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  auto_size_text: ^2.1.0
  cupertino_icons: ^0.1.2
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  font_awesome_flutter: ^8.7.0
  flutter_custom_clippers: ^1.1.0
  http: ^0.12.0+4
  html_unescape: ^1.0.1+3
  path_provider: ^1.6.5
  sqflite: ^1.3.0



dev_dependencies:
  flutter_test:
    sdk: flutter


flutter:

  uses-material-design: true

  assets:

这是我的 build.gradle

buildscript 
    repositories 
        google()
        jcenter()
        maven  url 'https://maven.google.com' 
    

    dependencies 
        classpath 'com.android.tools.build:gradle:3.5.0'
    


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

gradle.properties

org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true

app\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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android 
    compileSdkVersion 28

    lintOptions 
        disable 'InvalidPackage'
    

    defaultConfig 
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "mojtaba.azmoonasli"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    

    buildTypes 
        release 
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        
    


flutter 
    source '../..'


dependencies 
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

颤抖的医生

[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.720], locale en-US)
    • Flutter version 1.12.13+hotfix.8 at D:\FlutterSDK\flutter
    • Framework revision 0b8abb4724 (5 weeks ago), 2020-02-11 11:44:36 -0800
    • Engine revision e1e6ced81d
    • Dart version 2.7.0

[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\mojta\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-Q, build-tools 28.0.3
    • Java binary at: D:\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    X Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.

[√] Android Studio (version 3.6)
    • Android Studio at D:\Android Studio
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] Connected device (1 available)
    • Google Nexus 5 0 • 192.168.96.103:5555 • android-x86 • Android 5.0 (API 21)

! Doctor found issues in 1 category.

感谢您的宝贵时间❤

【问题讨论】:

【参考方案1】:

在 build.gradle 文件更改

classpath 'com.android.tools.build:gradle:7.0.0'

classpath 'com.android.tools.build:gradle:4.1.0'

因为类路径 'com.android.tools.build:gradle:7.1.0' 不再受支持。

【讨论】:

【参考方案2】:

在您的 pubspec.yaml 文件中执行右上角给出的 pub upgrade 命令或在终端运行:flutter pub upgrade --major-versions 然后重建项目希望它对你有用。

【讨论】:

【参考方案3】:

以下步骤帮助了我:

-->升级 Gradle .

-->运行“flutter clean”。

-->运行“颤振运行”。

【讨论】:

【参考方案4】:

我尝试了以下方法,问题解决了。

    在 android studio 中打开 pubspec.yaml 文件并在窗口顶部单击 Flutter Upgrade。或者从这里下载并安装它:https://flutter.dev/docs/get-started/install/windows。 更新flutter后问题应该解决了。

    如果不起作用,请删除flutter SDK并从https://flutter.dev/docs/get-started/install下载并再次运行项目。

    (不推荐)如果问题仍然存在,您可以删除包括颤振在内的所有内容,重新安装并更改为稳定频道,应该会再次正常。

【讨论】:

我确实重新安装然后它工作了

以上是关于任务 ':path_provider:extractDebugAnnotations' 执行失败的主要内容,如果未能解决你的问题,请参考以下文章

任务计划程序打开软件的原理

CELERY 定时任务

“异步任务然后等待任务”与“任务然后返回任务”[重复]

宏任务和微任务的执行顺序

宏任务和微任务

20230515学习笔记——js中的同步任务与异步任务,宏任务与微任务