You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

首次运行Flutter应用失败:无法下载bcprov-jdk15on.jar依赖

Fix for Flutter App Launch Failure: Gradle Can't Download bcprov-jdk15on-1.56.jar

Hey there! I’ve dealt with this exact Gradle download error when setting up new Flutter projects before—super frustrating, but totally fixable. Let’s walk through the solutions step by step:

Common Causes

The root issue here is that JCenter (the repository Gradle is trying to pull the jar from) has been archived and is no longer maintained since 2021. Many old packages hosted there are either unavailable or slow to download, especially with network restrictions.

Step-by-Step Fixes

1. Check Your Network Connection

First, rule out basic network issues:

  • Try switching to a stable network (like a mobile hotspot if you’re on a restricted work/school network)
  • Ensure you can access external Maven repositories without proxy blocks

2. Replace JCenter with Active Repositories

Since JCenter is no longer reliable, update your Gradle config to use maintained repositories like Maven Central or domestic mirrors:

  • Open your project’s android/build.gradle file
  • Find the repositories blocks (both in buildscript and allprojects) and replace jcenter() with:
    repositories {
        google()
        mavenCentral()
        // Optional: Add Alibaba Maven mirror for faster downloads in regions with slow global access
        maven { url 'https://maven.aliyun.com/repository/public' }
    }
    
  • Do the same check in android/app/build.gradle if there’s a repositories block present

3. Clean Gradle Cache & Rebuild

Corrupted cache files often cause download failures. Let’s wipe them:

  • Run this command in your project root:
    flutter clean
    
  • Delete the android/.gradle folder manually (it will regenerate automatically)
  • Run flutter pub get to refresh dependencies, then try launching your app again

4. Manual Jar Import (Last Resort)

If the above steps don’t work, you can manually add the jar file:

  • Download bcprov-jdk15on-1.56.jar (search for it on Maven Central to find a valid source)
  • Create a libs folder in android/app/ and place the jar inside it
  • Add this line to the dependencies block in android/app/build.gradle:
    implementation files('libs/bcprov-jdk15on-1.56.jar')
    
  • Rebuild your project

内容的提问来源于stack exchange,提问作者SouRav GhoSh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 11:22:14