Installation of certificate in Android Studio

מתוך ויקי נטפרי
קפיצה אל: ניווט, חיפוש

לעברית לחצו כאן

To switch from edit view to read view

To search in the Wiki

Home page > Security certificate > Installation of certificate in Android Studio ‎‎

Download the certificate for your Internet provider from here:

Open the Settings window in Android Studio: File > Settings > Tools > Server Certificates,

Click on the green plus and add the certificate from the downloaded file.


Note: This solution is probably not useful for the gradle subprocesses that the IDE runs. It turns out you will get gradle errors and need the next solution.

If this does not work, try the next step:

Open the command prompt in Admin mode, and paste the following command (before doing so change the certificate location if it is not in drive C):

"C:\Program Files\Android\Android Studio\jre\jre\bin\keytool" -noprompt -trustcacerts -keystore "C:\Program Files\Android\Android Studio\jre\jre\lib\security\cacerts" -importcert -alias nf -file "C:\netfree-ca.crt" -storepass changeit
The command for macOS is:
sudo keytool -import -trustcacerts -alias netfree-ca -file Downloads/netfree-ca.crt -keystore /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/security/cacerts -storepass changeit

Replace Downloads/netfree-ca.crt with the path to the NetFree certificate which may be downloaded from here.

Note: This solution will cause an error when trying to install updates to the IDE. This is caused by a change to one of the software's core files. To install software updates to the IDE, we recommend that you back up the cacerts file before running the action. Before installing an update, restore the cacerts file from the backup file. After installing the update you will need to run the above commands again.

Another option is to download the full new version and install it instead of upgrading from the software.

Alternate method

If you have on your computer another JDK installed with NetFree's certificate, you can configure Android Studio to use an alternate JDK instead of its embedded JDK.

To do this, press ctrl + shift + a, type the command: "switch boot JDK" and enter.

In the next window you select the replacement JDK.

Note: Doing so can cause unexpected problems and is at the user's sole responsibility.