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

Android Studio 3.1.1同步成功但报HttpRequestException警告求助

Fixing SSLHandshakeException When Syncing Android Studio 3.1.1 Project

Hey there, let's work through this SSL handshake warning you're seeing. Even though your project sync finishes successfully, that PKIX path building failed error means your system can't verify the SSL certificate for the jcenter repository—here are some tried-and-true fixes:

1. Check Proxy Settings

First up, proxies often mess with SSL certificate verification. Head over to Android Studio's Settings > Appearance & Behavior > System Settings > HTTP Proxy and switch to No proxy. Then click Apply and re-sync your project. If you need a proxy, make sure it's configured to properly pass SSL traffic without intercepting certificates.

2. Align Gradle Plugin & Android Studio Versions

Your error mentions trying to fetch gradle-3.1.2.pom, but you're on Android Studio 3.1.1. Version mismatches can cause unexpected issues:

  • Open your project's root build.gradle file
  • Update the Gradle plugin classpath to match your AS version:
    buildscript {
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.1' // Match your AS 3.1.1 version
        }
    }
    
  • Also check the Gradle wrapper version in gradle/wrapper/gradle-wrapper.properties—make sure it's compatible with the 3.1.1 plugin (Gradle 4.4 is recommended for plugin 3.1.1).

3. Import Missing SSL Certificate to Java Truststore

If your system doesn't trust jcenter's SSL certificate, you'll need to manually add it to your Java truststore:

  1. Open https://jcenter.bintray.com in your browser, click the lock icon in the address bar, and export the site's SSL certificate (save it as a .cer file in DER format).
  2. Locate the truststore file for your Java installation—usually at JDK_HOME/jre/lib/security/cacerts or the embedded JRE in Android Studio (look under Android Studio/jre/lib/security/cacerts).
  3. Run this keytool command to import the certificate (replace paths with your own):
    keytool -import -alias jcenter-cert -keystore /path/to/cacerts -file /path/to/your/certificate.cer
    
    The default truststore password is changeit—enter it when prompted.
  4. Restart Android Studio and re-sync your project.

If you need a quick fix (and understand the security risks), you can bypass SSL checks for jcenter:

  • In your project's build.gradle, replace the jcenter entry with either the HTTP version:
    repositories {
        jcenter {
            url "http://jcenter.bintray.com/"
        }
    }
    
  • Or, if you're using Gradle 6.0+, use the insecure protocol flag:
    repositories {
        maven {
            url "https://jcenter.bintray.com/"
            allowInsecureProtocol = true
        }
    }
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 03:55:58