Android Studio fails to install update (error : Failed to read or create install properties file.)
Asked Answered
C

15

75

Screenshot of error

enter image description here

I am running [ Android Studio 2.3 Build #AI-162.3764568, built on February 24, 2017 JRE: 1.8.0_112-release-b06 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o] on Ubuntu 16.04. From last few days android studio gives me error on trying to update. I have no idea how to fix this.

Clench answered 27/3, 2017 at 9:0 Comment(0)
J
186

I ran the Android studio as administrator and then it worked as it is a permission issue.

Jehovah answered 6/6, 2017 at 6:10 Comment(4)
Thanks for the tip. I seem always to forget setting AS to run as an administrator after each installation on a Windows PC.Approximate
or sudo if you're on command line: cd into $ANDROID_HOME$/sdk/tools/bin and sudo bash sdkmanager "platforms;android-26" "build-tools;26.0.1"Wieland
On Windows I manually had to create an empty repositories.cfg inside c:\users\me\.androidLashay
For Windows 10 to always run as administrator: 1- go to the startup location (something like C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Android Studio) 2- right-click the shortcut 3- select 'Troubleshoot Compatibility' 4- tick the box next to 'The application requires additional permissions' 5- click 'Test the program' (the program will start and the administrator confirmation dialog will appear) 6- after confirming, go back to the compatibility troubleshooter and click 'Next' 7- select 'Yes, save these settings for this program'. Now it will always run as administrator.Cantlon
H
70

chmod 777 $ANDROID_HOME -R This is not a good solution like @spark mentioned.

I solved this issue by setting the ownership to myself

sudo chown $USER:$USER $ANDROID_HOME -R

Hoatzin answered 7/2, 2018 at 6:22 Comment(6)
You should not change the directory ownership unless you have installed the SDK in that user's directory. Invoking sudo chown tells me otherwise.Venose
sudo chown $USER: $ANDROID_HOME -R should be enoughNanine
This worked for me, and I replaced the deprecated $ANDROID_HOME with $ANDROID_SDK_ROOT.Hedgcock
Changing the group instead of the owner and using g=u as permission might be a less invasive option. Making all files executable is not a very good idea.Athalie
On OSX, this command worked for me: sudo chown -R $USER: $ANDROID_HOME. The -R had to be moved at the front.Tonettetoney
sudo chown -R $USER: $ANDROID_HOME with the -R between chown and userEisteddfod
C
26

Problem Solved!

The permission of my Android directory was set to write only by root so android-studio was unable to write any changes. I changed the permissions to 777 and it fixed the problem.

Thanks for Help anyways.

Clench answered 27/3, 2017 at 10:2 Comment(5)
how to set permission of that folder?Willams
link to set permissions winaero.com/blog/…Inhaler
This is more of a workaround than a solution. Setting such permissions is a security problem.Warchaw
As stated by some people here already, setting folder permissions (and sub-folders using -R) to 777 is like saying "OK guys, this is free for all now!". The accepted solution should be the one proposed by @SAJAdriell
777 will make all files executable. Why not use go=u or ugo=rwX instead?Athalie
M
12

Solution 1:

Use: sudo chown $USER: $ANDROID_HOME -R

My solution is setting folder permissions (and sub-folders using -R).

Root cause:

The permission of my Android SDK directory was set to write only by root so android-studio was unable to write any changes.

Detailed Process:

Take $ANDROID_HOME/platform-tools for example:

sudo chown $USER: $ANDROID_HOME/platform-tools

Before executing the command line:

before executing the sudo chown

bin ls -la $ANDROID_HOME/
total 56
drwxr-xr-x@  26 gongzelong  staff    832 Nov  3 01:51 .
drwx------@ 104 gongzelong  staff   3328 Nov  6 17:55 ..
-rw-r--r--@   1 gongzelong  staff  18436 Oct 26 21:17 .DS_Store
drwxr-xr-x    2 gongzelong  staff     64 Nov  4 01:47 .downloadIntermediates
-rw-r--r--    1 gongzelong  staff     16 Nov  6 17:46 .knownPackages
drwxr-xr-x   41 gongzelong  staff   1312 Nov  4 23:08 .temp
-rw-r--r--@   1 gongzelong  staff   1158 Aug 30  2018 SDK Readme.txt
drwxr-xr-x@   2 gongzelong  staff     64 Aug 29  2016 add-ons
drwxr-xr-x@  34 gongzelong  staff   1088 Nov  3 01:47 build-tools
drwxr-xr-x@   6 gongzelong  staff    192 Apr 24  2019 cmake
drwxr-xr-x@  51 gongzelong  staff   1632 Oct 24  2016 docs
drwxr-xr-x   17 root        wheel    544 Nov 12  2019 emulator
drwxr-xr-x@   8 gongzelong  staff    256 Jul 31  2018 extras
drwxr-xr-x@   3 gongzelong  staff     96 Nov  7  2017 fonts
drwxr-xr-x@   9 gongzelong  staff    288 Apr 21  2020 licenses
drwxr-xr-x@   6 gongzelong  staff    192 Apr 24  2019 lldb
drwxr-xr-x    7 gongzelong  staff    224 Nov  4 22:47 ndk
drwxr-xr-x@  20 gongzelong  staff    640 Sep 29  2018 ndk-bundle
drwxr-xr-x@   5 gongzelong  staff    160 Dec 15  2016 patcher
**drwxr-xr-x   19 root        wheel    608 Nov 12  2019 platform-tools**
drwxr-xr-x@  16 gongzelong  staff    512 Nov  3 01:47 platforms
drwxr-xr-x@  33 gongzelong  staff   1056 Feb 17  2020 skins
drwxr-xr-x@  14 gongzelong  staff    448 Nov  3 01:51 sources
drwxr-xr-x@  13 gongzelong  staff    416 Apr  8  2019 system-images
drwxr-xr-x@   2 gongzelong  staff     64 Feb  4  2018 temp
drwxr-xr-x   15 gongzelong  staff    480 Oct 26 21:18 tools

After executing the command line:

after executing the sudo chown

➜  bin ls -la $ANDROID_HOME/
total 56
drwxr-xr-x@  26 gongzelong  staff    832 Nov  3 01:51 .
drwx------@ 104 gongzelong  staff   3328 Nov  6 17:55 ..
-rw-r--r--@   1 gongzelong  staff  18436 Oct 26 21:17 .DS_Store
drwxr-xr-x    2 gongzelong  staff     64 Nov  4 01:47 .downloadIntermediates
-rw-r--r--    1 gongzelong  staff     16 Nov  6 17:46 .knownPackages
drwxr-xr-x   41 gongzelong  staff   1312 Nov  4 23:08 .temp
-rw-r--r--@   1 gongzelong  staff   1158 Aug 30  2018 SDK Readme.txt
drwxr-xr-x@   2 gongzelong  staff     64 Aug 29  2016 add-ons
drwxr-xr-x@  34 gongzelong  staff   1088 Nov  3 01:47 build-tools
drwxr-xr-x@   6 gongzelong  staff    192 Apr 24  2019 cmake
drwxr-xr-x@  51 gongzelong  staff   1632 Oct 24  2016 docs
drwxr-xr-x   17 root        wheel    544 Nov 12  2019 emulator
drwxr-xr-x@   8 gongzelong  staff    256 Jul 31  2018 extras
drwxr-xr-x@   3 gongzelong  staff     96 Nov  7  2017 fonts
drwxr-xr-x@   9 gongzelong  staff    288 Apr 21  2020 licenses
drwxr-xr-x@   6 gongzelong  staff    192 Apr 24  2019 lldb
drwxr-xr-x    7 gongzelong  staff    224 Nov  4 22:47 ndk
drwxr-xr-x@  20 gongzelong  staff    640 Sep 29  2018 ndk-bundle
drwxr-xr-x@   5 gongzelong  staff    160 Dec 15  2016 patcher
**drwxr-xr-x   19 gongzelong  wheel    608 Nov 12  2019 platform-tools**
drwxr-xr-x@  16 gongzelong  staff    512 Nov  3 01:47 platforms
drwxr-xr-x@  33 gongzelong  staff   1056 Feb 17  2020 skins
drwxr-xr-x@  14 gongzelong  staff    448 Nov  3 01:51 sources
drwxr-xr-x@  13 gongzelong  staff    416 Apr  8  2019 system-images
drwxr-xr-x@   2 gongzelong  staff     64 Feb  4  2018 temp
drwxr-xr-x   15 gongzelong  staff    480 Oct 26 21:18 tools

Then we do the update in SDK management: Before update

updaing the sdk 1

updaing the sdk 2

update successfully

before and after install sdk result screenshot

before and after install result screenshot

Solution 2:

Run Android Studio as administration.

sudo /Applications/Android\ Studio\ 4.1.0.app/Contents/MacOS/studio

It could also install the android sdk update successfully

before updating update successfully check and confirm the result

Masterpiece answered 6/11, 2020 at 13:12 Comment(0)
E
5

for macos:

sudo chmod -R 777 ~/Library/Android
Eisteddfod answered 17/1, 2019 at 8:21 Comment(3)
Awesome! Worked for me :) yay..!Metamer
This will only work if your ANDROID_HOME is ~/Library/Android 😉 — and 777 is a bit over the top. g=u (set group to user) might be a less invasive option.Athalie
Just look for a directory with wrong permissions and chown it.Weakly
S
4
  1. Delete old version
  2. Reboot
  3. Install new version

hope this helps :)

Snore answered 27/3, 2017 at 9:32 Comment(1)
It helped me while using: Android Studio Koala | 2024.1.1 Build #AI-241.15989.150.2411.11948838, built on June 10, 2024 Runtime version: 17.0.10+0-17.0.10b1087.21-11609105 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 14.5 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 8 Metal Rendering is ON Registry: ide.experimental.ui=true terminal.new.ui=true Non-Bundled Plugins: dev.j-a.swift (1.0.0.345-241) com.intellij.marketplace (241.15989.206) com.jetbrains.kmm (0.8.2(241)-6)Wreck
V
3

If you are on a *nix system, you should locate $ANDROID_HOME. Mine is installed inside /opt. Given that this directory belongs to root, you will need to invoke sudo before running your command.

Venose answered 13/3, 2018 at 10:13 Comment(0)
E
2

I had the same issues on windows and the problem for me was where the SDK was related.

When you go to File - Project Structure - Android SDK Location you can see what SDK directory is defined. The default SDK location was C:\Program Files (x86)\Android\android-sdk and it seems you need to be an Administrator to be able to download packages.

I changed it to my user directory so I don't need admin privileges and I was able to download the required packages without any problems.

Also make sure you accpeted all licences before.

Europe answered 18/1, 2021 at 8:41 Comment(1)
Running Android Studio with administrator privileges worked for my case.Allhallows
S
2

I was unable to update the platform-tools and emulators. What I found was there was an .installer directory in each of those directories. Deleting those allowed the update to complete.

Rogue .installer directory in platform-tools

Rogue .installer directory in emulator

Socinian answered 17/4, 2023 at 7:45 Comment(1)
Thanks for that tip. I tried any other solution regarding fixing permissions but nothing solved my error. But deleting those ".installer" directories solved it finally.Sate
N
1

I ran in to this issue and when I navigated to the existing install of the SDK I found that it was symlinked to a previous version that I installed using Homebrew (which is no longer supported).

The fix was to remove this symlink, then Android Studio was able to install the updated SDK as expected.

Nutlet answered 20/2, 2022 at 18:12 Comment(0)
N
0

I was facing the same problem, I solved it by first enabling the "Force https://... sources to be fetched using http://..." setting in the SDK Manager Tools > Options menu. and then I opened Android Studio as administrator.

Niehaus answered 5/8, 2020 at 0:12 Comment(0)
R
0

I faced a similar problem when I tried to install new packages using SDK Manager in the Android command line tool.

Error: failed to read or create install properties file in SDK manager.

The problem occurred because the SDK manager cannot figure out how to validate licenses without administrator permissions.

Solution: Run the command line as an administrator.

Respond answered 6/4, 2023 at 10:1 Comment(0)
S
0

I fixed this on linux by running sudo chown /opt/android-sdk Change /opt/android-sdk to the path of your android sdk

Shatterproof answered 25/4, 2023 at 22:32 Comment(0)
S
0

I had a fresh Installation of Android Studio. I ran the install script with root access the first time so my SDK files went buggy and the next time I opened Android Studio, It opened with regular user permissions and I was unable to update the SDK.

I just deleted the initial SDK folder and let the studio download it again and the problem was gone.

Spoonbill answered 6/8, 2023 at 11:15 Comment(0)
C
-3

In windows, you may run Android Studio as Administrator

Cleft answered 29/3, 2018 at 7:27 Comment(1)
The OP is running Ubuntu, and randomly running programs with elevated permissions is never a good ideaPahari

© 2022 - 2024 — McMap. All rights reserved.