Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error:Cause: unable to find valid certification path to requested target

I got the following Error in android Studio 2.2.3 when I sync gradle.

Error:Cause: unable to find valid certification path to requested target

How can I fix this issue

I am Adding my Gradle file also

apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig {     applicationId "com.sample.myapplication"     minSdkVersion 16     targetSdkVersion 22     versionCode 1     versionName "1.0"     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes {     release {         minifyEnabled false         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'     } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {     exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:design:23.4.0' compile 'com.android.support:palette-v7:23.4.0' testCompile 'junit:junit:4.12' // FireBase compile 'com.google.firebase:firebase-messaging:9.0.0' }//Add this line apply plugin: 'com.google.gms.google-services' 

and the project Level Gradle File

buildscript { repositories {     jcenter() } dependencies {     classpath 'com.android.tools.build:gradle:2.2.3'     classpath 'com.google.gms:google-services:3.0.0' } } allprojects { repositories {     mavenCentral()     jcenter{ url "http://jcenter.bintray.com/" }     maven { url "https://jitpack.io" } } } task clean(type: Delete) { delete rootProject.buildDir } 
like image 201
Renjith Krishnan Avatar asked Feb 23 '17 12:02

Renjith Krishnan


People also ask

How to solve unable to find valid certification path to requested target?

The problem appears when your server has self signed certificate. To workaround it you can add this certificate to the list of trusted certificates of your JVM. You can either edit JAVA_HOME/jre/lib/security/cacerts file or run you application with -Djavax. net.

Could not connect to server unable to find valid certification path to requested target?

This issue might arise if you are using a self-signed certificate or a certificate that's been issued by an internal certificate authority, or if your clients (e.g., browser, Java) are outdated. Trust is handled by having the root and intermediate certificates of your SSL certificate on a trusted keystore.


2 Answers

This problem might be due to some restricted internet connections... If you are installing build tools on some restricted network, the required certificates might not install... So try changing the network connection.... Worked for me.....

like image 149
Rajat Anand Avatar answered Sep 22 '22 19:09

Rajat Anand


I faced the same issue, but fixed it by adding

maven { url "http://jcenter.bintray.com"} 

in the project Level Gradle File

buildscript { repositories {     jcenter()     maven { url "http://jcenter.bintray.com"} } dependencies {     classpath 'com.android.tools.build:gradle:2.2.3'     classpath 'com.google.gms:google-services:3.0.0' } } allprojects { repositories {     mavenCentral()     jcenter{ url "http://jcenter.bintray.com/" }     maven { url "https://jitpack.io" } } } task clean(type: Delete) { delete rootProject.buildDir } 
like image 24
Amaldev Avatar answered Sep 22 '22 19:09

Amaldev