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

Ionic构建Android失败:无法连接jcenter.bintray.com超时

Ionic Android Build Fails Due to jcenter.bintray.com Connection Timeout

Hey there, let's work through this build failure you're stuck on. From the error details you shared, the core issue is that your build can't fetch required dependencies because of network timeouts connecting to jcenter.bintray.com—even without a proxy, this is a common problem with unstable networks, temporary jcenter outages, or outdated Gradle configs.

First, let's recap your environment setup for clarity:

Environment Information

Ionic/Cordova CLI:

@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
cordova (Cordova CLI) : 8.0.0

Local Project Packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.0.0
Ionic Framework : ionic-angular 3.9.2

System & Environment Variables:

Android SDK Tools : 26.1.1
Node : v8.11.1
npm : 5.6.0
OS : Windows 10
ANDROID_HOME : C:\Users\admin\AppData\Local\Android\sdk
backend : pro

Build Failure Error Log

When running ionic cordova build --debug android, you get:

FAILURE: Build failed with an exception.

  • 出错原因:配置根项目'android'时出现问题。

    无法解析配置':classpath'的所有文件。
    无法解析org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2,该依赖由多个Gradle模块所需;无法获取资源http://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.pom,连接jcenter.bintray.com:80超时。
    同时无法解析org.ow2.asm:asm:5.1、org.ow2.asm:asm-analysis:5.1等依赖,均因连接jcenter.bintray.com超时导致。

Solutions to Try

Let's go through fixes step by step, starting with the simplest:

1. Verify Network Access to jcenter

First, open your browser and try visiting http://jcenter.bintray.com. If it doesn't load, your network might be blocking it (some corporate networks do this) or jcenter is down temporarily. Try switching to a different network (like a mobile hotspot) and re-run the build to test.

2. Update Gradle Repositories

Jcenter has been sunset, so replacing or supplementing it with Maven Central (which hosts most of the same dependencies) can resolve this. Here's how:

  • Navigate to your project's android folder, open the root build.gradle file.
  • Look for the repositories blocks in both buildscript and allprojects sections. Add mavenCentral() before or alongside jcenter():
    buildscript {
        repositories {
            mavenCentral()
            jcenter() // You can keep this, but mavenCentral is more reliable now
        }
        // ... rest of your buildscript code
    }
    
    allprojects {
        repositories {
            mavenCentral()
            jcenter()
            // ... other repos like maven { url 'https://maven.google.com' }
        }
    }
    

3. Clear Gradle Cache

Corrupted cache files can sometimes cause dependency fetch issues. Delete the Gradle cache folder on your Windows machine:

  • Go to C:\Users\admin\.gradle\caches and delete all contents inside.
  • After deleting, re-run your build command: ionic cordova build --debug android

4. Increase Gradle Timeout Settings

If your network is slow, increasing the timeout for dependency downloads can help.

  • In the android folder, create or edit the gradle.properties file and add these lines:
    org.gradle.jvmargs=-Dhttp.connectionTimeout=120000 -Dhttp.socketTimeout=120000
    org.gradle.parallel=true
    
  • You can also add resolution strategy settings in the root build.gradle to force fresh checks for dependencies:
    buildscript {
        configurations.all {
            resolutionStrategy {
                cacheChangingModulesFor 0, 'seconds'
            }
        }
        // ... rest of your buildscript code
    }
    

5. Update Gradle Version

Your project is using an older Cordova Android version (7.0.0), which might rely on an outdated Gradle version. Try updating the Gradle wrapper:

  • Open android/gradle/wrapper/gradle-wrapper.properties
  • Update the distributionUrl to a newer stable version, like:
    distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
    

Give these steps a try—start with checking your network first, as that's the most likely culprit. If none of these work, we can dig deeper!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 03:56:58