简体   繁体   English

Gradle构建无法解析所有Path_provider依赖项

[英]Gradle build can not resolve all Path_provider dependencies

I was able to add path_provider library to my pubspec.yaml file and I used its functionalities in my code. 我能够将path_provider库添加到我的pubspec.yaml文件中,并且在我的代码中使用了它的功能。 When I tried to flutter run, I got an gradle build error. 当我尝试扑动运行时,出现了gradle构建错误。


This is the error message: 这是错误消息:

FAILURE: Build failed with an exception.                                

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

My android/build.gradle 我的android / build.gradle

buildscript {
repositories {
    google()
    jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
  }
}

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
}

What I tried: 我试过的

I solved this issue by doing the following : 我通过以下操作解决了这个问题:

  1. Upgrading Gradle to version 5.4.1 . 将Gradle升级到5.4.1版本。
  2. Upgrading Gradle plugin version to 3.5.0 . 将Gradle插件版本升级到3.5.0。
  3. Run the command ./gradlew dependencies in project's android directory which downloaded missing path_provider dependencies. 在项目的android目录中运行命令./gradlew dependencies ,该命令下载了缺少的path_provider依赖项。
  4. Run flutter clean then flutter run . 运行flutter clean然后flutter run

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM