'Untrusted Server Certificate in Intellij

I don't understand why Android Studio behaving weird, sending this Untrusted Server Certificate request again and again. Please suggest how to avoid this?

Pop up for accept or reject



Solution 1:[1]

I was facing this and came across a solution on JetBrain's community page.

To get rid of that, we need to make Idea Accept non-trusted certificates automatically.

Preferences -> Tools -> Server Certificates -> Check on "Accept non-trusted certificates automatically"

Preference page

Solution 2:[2]

You see this dialog b/c the proxy server in your network substitutes signed remote certificate certificate with it's own (non-trusted) certificate, hence it can not pass the JDK validation and IDE warns about it.

To fix this import this certificate to the JDK's which IDE uses to run trust store:

keytool -import -trustcacerts -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -alias Root -import -file certFile.cer

See Import the Certificate as a Trusted Certificate for more information.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pradipta Sarma
Solution 2 Andrey