Step 1 : Go to Download folder where you have downloaded the charles certificate i.e. pem file e.g. charles-ssl-proxying-certificate.pem
Step 2 : Open terminal for the downloaded folder.
Step 3 : Run the following command on terminal in downloaded path(e.g. /Users/sankalpsharma1/Downloads). Also, Check your keystore java path e.g. /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/security/cacerts
For Java 8
sudo keytool -import -alias charles.feb5 \
-file ./charles-ssl-proxying-certificate.pem \
-keystore /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/security/cacerts \
-storepass changeit
For Java 11
sudo keytool -import -alias charles.feb5 \
-file ./charles-ssl-proxying-certificate.pem \
-keystore /Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home/lib/security/cacerts\
-storepass changeit
Android Studio might have different JDK path. Use given below command in that case :
sudo keytool -import -alias charles.feb5 \
-file ./charles-ssl-proxying-certificate.pem \
-keystore /Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/jre/lib/security/cacerts \
-storepass changeit
Then, It might ask for password : Enter your system password
To verify the changes, run below command :
For IntelliJ : sudo keytool -list -keystore /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/security/cacerts -storepass changeit | grep charles
For Java 11
sudo keytool -list -keystore /Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home/lib/security/cacerts -storepass changeit | grep charles
For Android Studio : sudo keytool -list -keystore /Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/jre/lib/security/cacerts -storepass changeit | grep charles
Output on terminal would be like : charles.feb5, 13 Jul, 2021, trustedCertEntry,
Step 4 : Re-run the Applications.
Now PKIX certificate issue must be resolved.