Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to resolve 'unable to find valid certification path to requested target' on Android Studio 2.3.2

I am getting following error in Android Studio 2.3.2 when i am trying to create Empty Activity project. I also getting this when i try to import a project.

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

Here my gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

And

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 15
        targetSdkVersion 25
        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:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

I have also tried replacing jcenter() with

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

Or

maven  {
            url "http://repo1.maven.org/maven2"
        }

And my gradle distribution url is points to latest

distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip

I have already checked many threads in different forums but can't solve my one from these.

  1. Android Studio - Unable to find valid certification path to requested target
  2. Error:Cause: unable to find valid certification path to requested target

Edit: As the Android community seems pretty much inactive, what should i do now ? Someone please atleast as me in comment section.

In my another machine this error was shown with a URL. I resolved that by putting the jar into the libs folder after manually downloading. But for this problem, i can't find a solution!

like image 677
Rome Avatar asked May 25 '17 17:05

Rome


1 Answers

This is too late but I have faced same issue and resolve it.

I am getting this issue due to I am running Android Studio behind corporate proxy(Office PC). In this case you have to setup proxy in Android Studio.

Here is details form Android for Proxy setup:

Android Studio supports HTTP proxy settings so you can run Android Studio behind a firewall or secure network. To set the HTTP proxy settings in Android Studio:

  1. From the menu bar, click File > Settings (on a Mac, click Android Studio > Preferences).
  2. In the left pane, click Appearance & Behavior > System Settings > HTTP Proxy. The HTTP Proxy page appears.
  3. Select Auto-detect proxy settings to use an automatic proxy configuration URL for the proxy settings or Manual proxy configuration to enter each of the settings yourself. For a detailed explanation of these settings, see HTTP Proxy.
  4. Click Apply or OK for your changes to take effect.

Yo can find more details about this on below link https://developer.android.com/studio/intro/studio-config#proxy

Please refer attached screenshot (put your host name and port number while configuration)

like image 86
Gopal Avatar answered Nov 19 '22 19:11

Gopal