Currently I am working on making an app on android studio. I was trying to add the location awareness features to my app. Therefore, after installing the google play service in android studio, I added the new dependency rule compile 'com.google.android.gms:play-services:11.0.4'
. However, after I attempted to sync the gradle project but its displaying error saying
Error:Cause: unable to find valid certification path to requested target.
At first I checked into previous question that was asked before for same kind of error and I have tried every of those solution but it is still not working.
You likely have a proxy which is intercepting (via MITM) your traffic.
Locate your network's certificate: In a browser, navigate to https://www.google.com " hit F12, go to certificates/security and get the top most certificate... Export it to MyCertificate.cer
(base64 encoded). This process is different for each OS and Browser. Since you're on a linux/mac something like echo -n | openssl s_client -connect google.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/MyCertificate.cer
should get the certificate for you in a terminal (assuming you have your distributions net-utils package installed).
In a terminal, navigate to your Jetbrains installation (whichever IDE it is doesn't matter). Inside of the base folder navigate to the folder "jre64" or "jre32" or "jre" -> "lib" -> "security"
Copy over MyCertificate.cer
into the security folder. ( mv /tmp/MyCertificate.cer
)
Type keytool -keystore cacerts -importcert -alias MyCertificate -file MyCertificate.cer
Use the default password of changeit
.
When prompted to trust the certificate type yes
. Hit enter.
Restart the IDE in question and it should now function normally. Repeat this process for all java (including jdk) installations and jetbrains tools just to be safe. The relative path is the same regardless: jre -> lib -> security
Are you behind a (corporate) firewall? If yes and if possible, try syncing Gradle again using another internet connection (eg at your home). Else, Milk's answer might be more helpful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.