Android Studio报错:unable to find valid certification path to requested target

刚刚接触Android Studio,就遇到了这样的问题:
unable to find valid certification path to requested target
有的博客
说这是缺少证书导致的,但是很遗憾在我这里并没有得到解决!!!
再次经过我的努力,终于找到了解决办法

1、打开Projectbuild.gradle,将jcenter()删掉,换成:

jcenter{
            url 'http://jcenter.bintray.com'
        }

Android Studio报错:unable to find valid certification path to requested target_第1张图片
2、打开build.gradle(Module:app)文件,注释掉以下两个代码块:

 androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
 })

testCompile 'junit:junit:4.12'

再在最后加上代码块:

repositories {
    maven { url 'http://repo1.maven.org/maven2' }
}

Android Studio报错:unable to find valid certification path to requested target_第2张图片
大功告成,就可以运行了,点个赞呗
Android Studio报错:unable to find valid certification path to requested target_第3张图片

你可能感兴趣的:(Android)