I was getting this error in Android Studio. SO i did this after a lot of research.
Password is changeit for cacert
Step 1 : Open CMD as Administrator
Step 2 : Type "Powershell"
Step 3 : start-process powershell -verb runas
Step 4 : Add all your Certificate in C:\Program Files\Android\AndroidStudio\jre\lib\security this location where cacert is available.
Step 5 : Go to Keytool directory Set-Location -Path "C:\Program Files\Android\Android Studio\jre\bin"
Step 6 : run this command in powershell .\keytool -importcert -trustcacerts -alias GiveNameforyourcertificate -file "C:\Program Files\Android\Android Studio\jre\lib\security\Replace With Your Certificate name.cer" -keystore cacerts
Step 7 : If Error comes as Certificate added (Access denied) then create a D drive partition(https://www.diskpart.com/windows-10/how-to-create-d-drive-from-c-drive-in-windows-10-0725.html) or move you file to d drive then add certificate
If you kept your file in D drive then only execute this
Step 8 : keytool -importcert -trustcacerts -alias Nameyourcertificate -file "D:\Certificatename.cer" -keystore cacerts
Step 9 : Check if certificate was added or not using this command .\keytool -list -keystore cacerts