Flutter error: Could not download bcprov-jdk15on.jar (org.bouncycastle:bcprov-jdk15on:1.56)

Flutter error: Could not download bcprov-jdk15on.jar (org.bouncycastle:bcprov-jdk15on:1.56)

我未能 运行 我的第一个 Flutter 应用程序。出现以下错误。

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
Exit code 1 from: 

D:\PROJECTS\softwareProjects\AndroidProjects\flutter_app_2\android\gradlew.bat 
app:properties:
Download https://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.jar


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
   > Could not download bcprov-jdk15on.jar (org.bouncycastle:bcprov-jdk15on:1.56)
Finished with error: Please review your Gradle project setup in the android/ folder.
      > Could not get resource 'https://jcenter.bintray.com/org/bouncycastle/bcprov-jdk15on/1.56/bcprov-jdk15on-1.56.jar'.
         > Response 304: Not Modified has no content!

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

Flutter 医生没有给出任何问题 颤动医生的输出:

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.1.5, on Microsoft Windows [Version 10.0.16299.309], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[√] Android Studio (version 3.0)
[√] Connected devices (1 available)

• No issues found!

虽然 Flutter Analysis 给出了一些错误!

在发帖时,jCenter is/was 在处理某些工件时出现问题。 This gradle issue tracks progress on the fix, and bintray's status page 有一个 2018 年 3 月 17 日的条目详细说明了这个问题。

临时解决方法是使用 mavenCentral 而不是 jCenter(或者至少先使用它)。

这可以通过更改存储库 gradle 使用来完成。由于这是一个 android 项目,约定似乎按如下方式使用所有项目:

allprojects {
    repositories {
        google()
        mavenCentral()
        // jcenter()
    }
}

2021 年更新:

JCenter 现在已由管理它的公司 read-only 制作,并且真的不应该使用,因为它没有最新版本的工件。如果您必须使用它,至少将它放在您正在使用的任何其他存储库之后。