失败:配置项目“:path_provider”时出现问题

May*_*DBA 5 android dart android-studio flutter

命令没有错误flutter doctor -v

我尝试删除该path_provider_macos目录,但没有成功。

我更新了gradle插件,但还是不行。

我在 vscode 和 android studio 中都遇到了这个错误。我删除并安装了几次flutter sdk,还是不行。

当我将 gradle 版本更改为 3.3.0 时,出现了不同的错误。它也不起作用。

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'path_provider'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.11.
     Required by:
         project : > com.android.tools.build:gradle:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.analytics-library:shared:26.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.lint:lint-gradle-api:26.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:gradle-api:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > androidx.databinding:databinding-compiler-common:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0 > com.android.tools:sdk-common:26.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0 > com.android.tools:common:26.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0 > com.android.tools.build:manifest-merger:26.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0 > com.android.tools.analytics-library:tracker:26.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0 > com.android.tools:sdklib:26.3.0 > com.android.tools:repository:26.3.0
      > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.11.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.11/kotlin-stdlib-jdk8-1.3.11.pom'.
            > Could not HEAD 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.11/kotlin-stdlib-jdk8-1.3.11.pom'.
               > Remote host terminated the handshake
   > Could not resolve org.ow2.asm:asm:6.0.
     Required by:
         project : > com.android.tools.build:gradle:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02
      > Could not resolve org.ow2.asm:asm:6.0.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm/6.0/asm-6.0.pom'.
            > Could not HEAD 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm/6.0/asm-6.0.pom'.
               > Remote host terminated the handshake
   > Could not resolve org.ow2.asm:asm-analysis:6.0.
     Required by:
         project : > com.android.tools.build:gradle:3.3.0
      > Could not resolve org.ow2.asm:asm-analysis:6.0.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-analysis/6.0/asm-analysis-6.0.pom'.
            > Could not HEAD 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-analysis/6.0/asm-analysis-6.0.pom'.
               > Remote host terminated the handshake
   > Could not resolve org.ow2.asm:asm-commons:6.0.
     Required by:
         project : > com.android.tools.build:gradle:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02
      > Could not resolve org.ow2.asm:asm-commons:6.0.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-commons/6.0/asm-commons-6.0.pom'.
            > Could not HEAD 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-commons/6.0/asm-commons-6.0.pom'.
               > Remote host terminated the handshake
   > Could not resolve org.ow2.asm:asm-util:6.0.
     Required by:
         project : > com.android.tools.build:gradle:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02
      > Could not resolve org.ow2.asm:asm-util:6.0.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-util/6.0/asm-util-6.0.pom'.
            > Could not HEAD 'https://repo.maven.apache.org/maven2/org/ow2/asm/asm-util/6.0/asm-util-6.0.pom'.
               > Remote host terminated the handshake
   > Could not resolve net.sf.jopt-simple:jopt-simple:4.9.
     Required by:
         project : > com.android.tools.build:gradle:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0
      > Could not resolve net.sf.jopt-simple:jopt-simple:4.9.
         > Could not get resource 'https://repo.maven.apache.org/maven2/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.pom'.
            > Could not HEAD 'https://repo.maven.apache.org/maven2/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.pom'.
               > Remote host terminated the handshake
   > Could not resolve net.sf.proguard:proguard-gradle:6.0.3.
     Required by:
         project : > com.android.tools.build:gradle:3.3.0
      > Could not resolve net.sf.proguard:proguard-gradle:6.0.3.
         > Could not get resource 'https://repo.maven.apache.org/maven2/net/sf/proguard/proguard-gradle/6.0.3/proguard-gradle-6.0.3.pom'.
            > Could not HEAD 'https://repo.maven.apache.org/maven2/net/sf/proguard/proguard-gradle/6.0.3/proguard-gradle-6.0.3.pom'.
               > Remote host terminated the handshake
   > Could not resolve com.squareup:javawriter:2.5.0.
     Required by:
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0
      > Could not resolve com.squareup:javawriter:2.5.0.
         > Could not get resource 'https://repo.maven.apache.org/maven2/com/squareup/javawriter/2.5.0/javawriter-2.5.0.pom'.
            > Could not HEAD 'https://repo.maven.apache.org/maven2/com/squareup/javawriter/2.5.0/javawriter-2.5.0.pom'.
               > Remote host terminated the handshake
   > Could not resolve org.bouncycastle:bcpkix-jdk15on:1.56.
     Required by:
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0 > com.android.tools:sdk-common:26.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0 > com.android.tools.build:apkzlib:3.3.0
      > Could not resolve org.bouncycastle:bcpkix-jdk15on:1.56.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.pom'.
            > Could not HEAD 'https://repo.maven.apache.org/maven2/org/bouncycastle/bcpkix-jdk15on/1.56/bcpkix-jdk15on-1.56.pom'.
               > Remote host terminated the handshake
   > Could not resolve org.bouncycastle:bcprov-jdk15on:1.56.
     Required by:
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0 > com.android.tools:sdk-common:26.3.0
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0 > com.android.tools.build:apkzlib:3.3.0
      > Could not resolve org.bouncycastle:bcprov-jdk15on:1.56.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.pom'.
            > Could not HEAD 'https://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.pom'.
               > Remote host terminated the handshake
   > Could not resolve org.ow2.asm:asm-tree:6.0.
     Required by:
         project : > com.android.tools.build:gradle:3.3.0 > com.android.tools.build:builder:3.3.0
      > Could not resolve org.ow2.asm:asm-tree:6.0.
Run Code Online (Sandbox Code Playgroud)

ism*_*isi 0

您是否在 android 清单中添加了读/写外部存储的权限。

如果没有,则需要 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 在 android 清单文件中添加。

您还需要在调用之前获得运行时权限getExternalStorageDirectory();,您可以使用名为permission_handler的包