Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

Ask Question

I'm failing to run my first ever Flutter App. Getting the below error.

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 doctor is not giving any problem output of flutter doctor:

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 gives some errors though!

At the time of posting, jCenter is/was having an issue serving certain artifacts. This gradle issue tracks progress on the fix, and bintray's status page has an entry for March 17, 2018 detailing the problem.

A temporary workaround is to use mavenCentral instead of jCenter (or at least use it first).

This can be done by changing the repositories gradle uses. Since this is an android project the convention seems to be using allprojects as follows:

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

UPDATE 2021:

JCenter has now been made read-only by the company that manages it, and should really not be used as it won't have the most recent version of artifacts. If you must use it, at least put it after any other repositories you are using.

Yes it worked! Putting jcenter() first causes the failure, when mavenCentral() was put before jcenter() , the app got built without any issue. – SouRav GhoSh Mar 20, 2018 at 6:45 Perfect Solution. But i have question on it. My project was working fine before it but in next day when i try to generate signed build, that error was generation. it was working fine for debug apk build process. I solved my issue by changing repository sequences. but for deep understanding, it would be good if any one knows exact issue. Thanks a lot. – DKHirani Oct 26, 2021 at 12:59 @DKHirani it actually appears that JCenter has been disabled - it is now read only and nothing new can be added, therefore it won't have the newest version of artifacts and should not be relied upon. Changing the order makes it so that gradle checks the other repositories listed first (google and then mavenCentral) before falling back to jcenter. Realistically, this should probably be updated to say that jcenter should be removed completely. As to why your build started failing suddenly, that's probably because it actually checked against the source rather than using a cached file. – rmtmckenzie Oct 27, 2021 at 8:54

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.