Configure Proxy settings in Android Studio 3.2.1

Seintsan Bo
2 min readJan 27, 2019

--

This is for my personal use .

  1. This story started when I couldn’t push my updated sources code to bitbucket. Then I found out that wifi that I was using , has firewall. Error message that I kept getting was

“ Failed with error: unable to access ‘https://…./git/’ : Failed to connect to bitucket.org port 443: Time out”

To solve this issue , you just need to add proxy settings in android studio

Android Studio => File=> Settings => System Settings => HTTP Proxy

You change proxy settings according to your Network Admin and click apply . You will be able to git/github.

If you are using bitbucket , you may face certificate issues . You can check in this link .

2. “ Unable to find valid certification path to requested target” for dl.google.com

For this case , You need to go to your browser and type www.google.com . After page is loaded, right click and inspect .Go to security tab. You will see certificate as per screenshot

click on “View certificate” button and certificate detail will be shown. In Detail Tab => click “ copy file” and certificate export wizard will appears. You export with base-64 encoded and save with name “MyCertificate” in your computer. And copy your certificate to Java certificate folder path .In my case

C:\Program Files\Java\jdk1.8.0_172\jre\lib\security .

Open command line and change to the path above. and import certificate using the following command . and use the password changeit .

C:\Program Files\Java\jdk1.8.0_172\jre\lib\security>keytool -keystore cacerts -importcert -alias MyCertificate -file MyCertificate.cer

Enter keystore password:

Trust this certificate? [no]: yes
Certificate was added to keystore

Then you can successfully build . If you have same certificate error for other server like jcenter , maven , you need to do the same steps .

Reference : Stackoverflow and https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000094584-IDEA-Ultimate-2016-3-4-throwing-unable-to-find-valid-certification-path-to-requested-target-when-trying-to-refresh-gradle

--

--