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:
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:
➜ 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 and after install sdk 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