2
votes

I was able to add path_provider library to my pubspec.yaml file and I used its functionalities in my code. When I tried to flutter run, I got an gradle build error.


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

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:

1

1 Answers

1
votes

I solved this issue by doing the following :

  1. Upgrading Gradle to version 5.4.1 .
  2. Upgrading Gradle plugin version to 3.5.0 .
  3. Run the command ./gradlew dependencies in project's android directory which downloaded missing path_provider dependencies.
  4. Run flutter clean then flutter run.