Jenkins本地构建Ionic Android项目失败:依赖解析错误求助
Hey there! Let's break down what's going on with your Android build failure in Jenkins, and fix it step by step.
核心错误原因
This is not a dependency issue — the real problem lies in your network proxy configuration. The repeated error corphttpsproxyhost.yourdomain: Name or service not known tells us that the Jenkins machine can't resolve the proxy server's domain name. Because of this, Gradle can't reach the remote repositories (jcenter and maven.google.com) to download the Android Gradle Plugin 3.0.0 files it needs to configure the build.
In short: Your Jenkins environment has an incorrect/unresolvable HTTP/HTTPS proxy set up, which is blocking Gradle's dependency download requests.
解决步骤
Here's how to fix this:
Check Jenkins Global Proxy Settings
- Go to your Jenkins dashboard → Manage Jenkins → Configure System.
- Find the "Proxy Server" section. Verify if the proxy host
corphttpsproxyhost.yourdomainis correct. Try pinging this domain from the Jenkins machine — if it fails, you either have a typo in the proxy address, or your machine's DNS can't resolve this internal proxy domain. Correct the host name or fix the DNS resolution.
Inspect Gradle Proxy Configuration
- Gradle might have its own proxy settings separate from Jenkins. Check the
gradle.propertiesfile (either in your project's root directory, or in the Jenkins user's.gradlefolder) for lines like:systemProp.http.proxyHost=corphttpsproxyhost.yourdomain systemProp.http.proxyPort=XXXX systemProp.https.proxyHost=corphttpsproxyhost.yourdomain systemProp.https.proxyPort=XXXX - If these exist, confirm the proxy details are accurate. If you don't need a proxy (e.g., your local network can access maven repositories directly), comment out these lines.
- Gradle might have its own proxy settings separate from Jenkins. Check the
Verify Network Connectivity
- On the Jenkins machine, run this command manually to test if you can reach the dependency URL:
curl https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom - If curl throws the same "name or service not known" error, focus on fixing your network/proxy setup first — this is the root block.
- On the Jenkins machine, run this command manually to test if you can reach the dependency URL:
Optional: Use Domestic Maven Mirrors
- If you're having trouble accessing foreign repositories, replace the default repositories in your project's
android/build.gradlewith domestic mirrors (like Alibaba Cloud) to bypass proxy issues:buildscript { repositories { maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/google' } jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0' } } - This will make Gradle prioritize downloading dependencies from faster, more accessible domestic sources.
- If you're having trouble accessing foreign repositories, replace the default repositories in your project's
内容的提问来源于stack exchange,提问作者Akshay Paliwal

