"PKIX path building failed" 更新到 AS 3.3 后

"PKIX path building failed" after updating to AS 3.3

这是我在构建选项卡中得到的:

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve com.github.chrisbanes:PhotoView:2.3.0.
     Required by:
         project :app
      > Could not resolve com.github.chrisbanes:PhotoView:2.3.0.
         > Could not get resource 'https://jitpack.io/com/github/chrisbanes/PhotoView/2.3.0/PhotoView-2.3.0.pom'.
            > Could not GET 'https://jitpack.io/com/github/chrisbanes/PhotoView/2.3.0/PhotoView-2.3.0.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.github.yalantis:ucrop:2.2.2.
     Required by:
         project :app
      > Could not resolve com.github.yalantis:ucrop:2.2.2.
         > Could not get resource 'https://jitpack.io/com/github/yalantis/ucrop/2.2.2/ucrop-2.2.2.pom'.
            > Could not GET 'https://jitpack.io/com/github/yalantis/ucrop/2.2.2/ucrop-2.2.2.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

项目build.gradle:

buildscript {
    repositories {
        jcenter()
        google()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
        classpath 'io.fabric.tools:gradle:1.+'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

所以解决方案是使用嵌入式 JDK,这是推荐的方式。

文件 → 项目结构 → SDK 位置 → 使用嵌入式 JDK