24

I am on Android Studio 3.0.1 and wanted to upgrade it to latest one. But I am getting this attached error due to jre/jre/lib/security/cacerts.

Does any one have any idea how to fix it? It says patch cannot be applied.

enter image description here

Zoe
  • 23,712
  • 16
  • 99
  • 132
Raulp
  • 6,261
  • 11
  • 73
  • 129

4 Answers4

30

I also modified my cacerts file to include a corpo firewall CA cert, but instead of having to reinstall Android Studio, I just

  1. Download the full .zip from Google's Archive that corresponded to my current version (in my case 3.1.3), then

  2. Extract the cacerts file and replaced my modified one.

  3. Run the update patch normally.

You will probably need to re-add your company CA to the newer version of cacerts. And if you are like me and don't deal with keytool very often, you probably don't remember the command so here you go (Password is changeit, but don't :)

keytool -import -alias key_alias -file "C:\Path\to\corpo_cert.der" -keystore "C:\Program Files\Android\Android Studio\jre\jre\lib\security\cacerts"

Matthew Weber
  • 723
  • 8
  • 20
  • 1
    BTW, if someone knows where/how to download just the cacerts file from this release, it would speed up this process because the installer is almost a GB. – Matthew Weber Mar 06 '19 at 19:44
  • Good solution - do you know if the cacerts file is modified by Google in any form? I've had to modify the cacerts file for a standalone enterprise Java application before and was just a part of the JRE being used, if Google don't modify the file you could just use the file from your JDK/JRE? – Mark May 09 '19 at 15:22
  • It is likely they are modifying the cacerts that comes from Oracle, but (unfortunately) I don't work for Google. Actually, I believe they start from a fork of JetBrains IDEA so that file may be modified by JetBrains, then Google. – Matthew Weber May 09 '19 at 15:26
  • @MatthewWeber the Keytool command is very well known, but its an overhead. Isn't it the same thing we do form the Android Studio User I/f of Android Studio when we go to Settings>Tools>Server Certificates >'+'>add Certificates(Browse for it) – Raulp Jun 09 '19 at 03:24
  • This particular question is about resolving an issue with an already manually modified cacerts file. I assume adding the cert via the built-in functionality as you've said would be accounted for by the updater and not result in this error. In my case, however, adding the cert in that fashion did not resolve my issue so I had to modify the cacerts file manually. – Matthew Weber Jun 11 '19 at 16:58
  • It's almost like clockwork. Every time there is an Android Studio update, this answers gets an upvote from at least one person. Maybe the question-asker could mark it as the correct answer, ah-hem :) – Matthew Weber Jul 12 '19 at 15:16
  • 2
    Thanks, this works, but instead of importing my certificates I just backed up my existing cacerts and then copied it back over after successfully patching from 3.4.1 to 3.4.2. – Meanman Jul 26 '19 at 15:55
  • 1
    Yes, making a backup before modifying a config file is always the best practice. This is just a work-around for those of us that forgot that. – Matthew Weber Jul 26 '19 at 18:49
1

I had a similar problem with the PNG icon from the installation folder. After saving the Android Studio ZIP archive, I searched for the damaged image (without unpacking the entire archive), unpacked and copied it to the folder where it was located. Upgrading is Android Studio worked seamlessly. Here's a picture:

0

I had the same issue. In my case I had added our proxy server certificate to cacerts manually. I deleted that cert (from C:\Program Files\Android\Android Studio\jre\jre\lib\security\cacerts) and that fixed the issue. Hope this helps.

Laks
  • 1
-1

OK , I was not able to find the answer for this. May be this is something related to the jre version. Anyway I fixed this by uninstalling the Android Studio completely(instead of upgrading) and then installing the new Android Studio. Android Studio used the kre internally installed @ C:\Program Files\Android\Android Studio\jre

and this is the path to new cacerts : C:\Program Files\Android\Android Studio\jre\jre\lib\security

Raulp
  • 6,261
  • 11
  • 73
  • 129