66

I have installed Latest version of Android studio from Google. After launching it, it tries to download some packages.

After a while it shows the following error.

The following SDK components were not installed: extra-android-m2repository, tools, addon-google_apis-google-21, android-21, sys-img-x86-addon-google_apis-google-21, source-21, extra-google-m2repository

I couldn't rectify the error, even though I pressed Retry multiple times.

Anyone can suggest solution!

jww
  • 97,681
  • 90
  • 411
  • 885
Jeeva
  • 661
  • 1
  • 5
  • 7
  • The problem you were facing, did it got resolved. And if no can you tell the location you had selected at the time of installation of android studio and android sdk. I think i can you help you out – foxt7ot Feb 19 '15 at 17:49
  • My issue was specifically a freak issue with build-tools 33.0.0 https://stackoverflow.com/a/68430992/332578 – Jacksonkr Oct 03 '22 at 22:35

27 Answers27

48

I had been facing the similar problem in Windows 7 and got the below problems while running the android-studio shortcut from my start programs menu for the first time.

Screenshot_1

Solution : Run As Administrator

The problem was due to the write permission in Windows C: drive and the Access is Denied message is displayed. Running the program as administrator downloads all the necessary components and now I can start Android Studio IDE.

Android Studio - Setup Wizard Success as Administrator

Update:

These permission issues doesn't seem to exist in Android Studio latest versions(checked in 1.3.2 in Windows 10) and works without the "Run as administrator" commands. If you still have the problem with the old/latest versions then it might be your firewall and proxy issues. In that case check out the other answers.

Lucky
  • 16,787
  • 19
  • 117
  • 151
  • 1
    my problem still remains and wont solve with this way! – Mahdi Jan 10 '15 at 11:08
  • @Kenji could u be more specific on what error you get while u start Android Studio..? – Lucky Jan 10 '15 at 11:10
  • 1
    yes. I downloaded last version of Ansdroid studio. i also have eclips and SDK updates. when I wannaRun android studio stup wizard runs and go for download components. then I had a error like this and app closes: There is nothing to install or update. The following SDK components were not installed: tools, extra-android-m2repository and then app closes. – Mahdi Jan 10 '15 at 11:14
  • if you are using Windows, after installing did u "Right click" and "Run as Administrator" the Android studio application..? because that solves the problem..is it an Access Denied issue u have? – Lucky Jan 10 '15 at 11:22
  • @Kenji..if it is an Access Denied problem, running as Administrator should solve you the problem..please check if you meet the android studio installation requirements..http://developer.android.com/sdk/index.html#Requirements..if you still face the problem you can download the zip files separately and extract it in you Android studio sdk folder(eg.C:\Users\admin\AppData\Local\Android\sdk\*)..and try starting your application again..but i dont recommend this unless you know what you are doing..so pls be careful..else just uninstall and reinstall the Android Studio appropriate for your Windows. – Lucky Jan 10 '15 at 11:39
  • yes i have requirements. I also have JDK 8. can i change a default path of SDK before Android Studio first run? cuse SDK folder is about 20 GB and in my D: dont have sufficient space on derive c. – Mahdi Jan 10 '15 at 11:47
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/68546/discussion-between-lucky-and-kenji). – Lucky Jan 10 '15 at 11:48
  • 1
    Ok it's worked for me and it's about proxy. here is your point ;) – Mahdi Jan 11 '15 at 12:45
  • 2
    This also solved the problem in linux! sudo ./studio.sh works! Thanks a bunch! – BlackSoil Jun 26 '15 at 00:30
  • I had the same issue on win10, I disabled my antivirus, then it worked – Joyal Sep 16 '17 at 13:04
20

Windows: run as Administrator, Linux: sudo

Michał Sułek
  • 278
  • 2
  • 11
18

A possible solution would be to check your proxy settings; under Windows 7 you can find those settings in the other.xml file present under the path C:\Users\YourUsername\\.AndroidStudio\config\options.

Note that if you turn both options "USE_HTTP_PROXY" and "USE_PROXY_PAC" to true the error keep coming but a pop-up should come out noticing the problem of a double configuration and prompting a resolution with a input window for those settings.

UPDATE - Possible solution

I've just managed to complete the wizard at home, maybe the proxy is not the real problem (as the last comment of @meanderingmoose pointed out). It seems there is a problem with the default installer of Android Studio 1.0.0, the one that contain both the IDE and di SDK Tools: the default installation path for the android sdk tools ends with myInstallPath../sdk/android-sdk but the first run setting for the Android Studio points at ..myInstallPath../sdk. So here is what i did.

  • Cut & Paste the content of the android-sdk folder outside the folder, so the files are under ..myInstallPath../sdk/
  • Use SDK Manager from the new location to update everything (Use this instead of the automatic wizard, you can select which package you want or need and you get also the speed and estimate time for the download)
  • Run Android Studio (it should load and check that the SDK is up to date and start the creation of an AVD, after that the IDE will load completely)

UPDATE - Workaround for the "download interrupted: read timed out" problem

The firewall and the proxy prevented my SDK Manager to download some updates, so i've recovered the .xml url for these updates, searched for the .zip files i needed and directly downloaded them with the help of a download manager, then i've manually installed them in their relative folder under the sdk folder ..a bit tricky but worked for me. For example in the Addon_xml_file i've searched for the m2repository, found the entry and downloaded the archive with the link m2repository_r14_zip_file. You always find the files you need in the same base as the .xml file (take a look at the url i've posted for the example).

nbarzan
  • 189
  • 3
  • This didn't work for me, they were both false and I changed them both to true and nothing different happened. – meanderingmoose Dec 09 '14 at 20:14
  • 1
    I've tested that method to get the pop-up window behind the proxy at work on two different machines, and worked pretty well. Sorry i couldn't help you.. – nbarzan Dec 09 '14 at 20:46
  • 1
    The pop-up window opens but its not functional, I'll keep working on solutions. Appreciate your help. – meanderingmoose Dec 09 '14 at 20:57
  • @meanderingmoose I've added some information in my answer for the download of some components under a firewall/proxy – nbarzan Dec 10 '14 at 12:13
  • This seems to work for everyone, but I can't get it to work. The SDK is downloading to c:\Users\\AppData\Local\Android\sdk.. It seems ok until it tries to move the files to the correct directory.. I have ran as admin, but not seeing what is wrong. – Cayce K Jan 16 '15 at 18:19
  • @CayceK I don't know the version of your Android Studio installer and if google fixed their installer issue, but based on your post your SDK Manager is downloading in the correct path `c:\Users\\AppData\Local\Android\sdk` and not inside a subfolder of the path named `android-sdk` as in my case. If that's the case you don't need to move anything, maybe you have a problem with connection to download some updates. Also I've noticed that your SDK Manager is installed inside a hidden/protected folder?You could try to reinstall everything on simple location, for example `C:\Android` – nbarzan Jan 22 '15 at 09:14
  • I had the same problem and here is what worked for me. I started the SDK Manager.exe inside C:\Users\User\AppData\Local\Android\sdk2 instead of using the start menu - Android - SDK manager because after uninstalling and re-installing several times, I found out that I have several SDK directories in C:\Users\User\AppData\Local\Android so starting SDK manager.exe inside the latest "correct" directory solved my problem. If it can help you. – Fred Smith Mar 11 '15 at 14:09
  • ... also you can have many sdk folders , named like sdk1 ..., see the last data modifier and make update with : tools\android.bat update sdk --no-ui – Cătălin George Feștilă Apr 25 '15 at 17:45
  • Re. second workaround: How do I find out what is insertion point for unzipped downloads? I have a file called `google_m2repository_gms_v9_3_rc10_wear_2_0_2_rc1.zip` (that, according to error messages, failed due to "time out") that I downloaded manually. It unzips into a directory called `m2repository`. On my (Linux) system, subdirectories of `~/Android` include `./Sdk/extras/google/m2repository`, `./Sdk/extras/android/m2repository` and `./Sdk/extras/m2repository`. – Lori May 20 '17 at 13:14
17

In OS X run as admin the first time by opening a new Terminal and run the commands:

cd /Applications/Android\ Studio.app/Contents/MacOS/

sudo ./studio

PlainOldProgrammer
  • 2,725
  • 5
  • 22
  • 30
9

Android Studio was not able to connect to internet in my work PC due to Intranet Proxy/Firewall settings, changing the proxy settings didnt help me either.

Android studio was failing to run as it requires to install the above mentioned packages. As a work around I installed the packages from Android SDK Manager and it solved it.

You can find the SDK Manager under C:\Users\< UserName> \AppData\Local\Android\sdk\SDK Manager.exe In the GUI choose the following options whichever is relavant.

  • Tools->All Android SDK Build-tools and SDK Platform-tools under version 21.*
  • Everything under Android 5.0.1(API 21)
  • Everything under Extras

After installation is complete try launching the Android Studio

Carbine
  • 7,849
  • 4
  • 30
  • 54
8

In OSX , I solved this issue by :

Step 1:

Go to System Preferences > Network : Advanced

enter image description herebypass the dl-ssl.google.com

Step 2:

Go to Proxies and set bypass proxies as following :

enter image description here

Sean
  • 2,106
  • 2
  • 16
  • 24
Gaurav Gupta
  • 1,550
  • 4
  • 18
  • 35
8

Please do not run Desktop Applications as root. This is a dangerous habit.

I was able to resolve this problem by closing the window with the (X) at the top right. It asked me whether to run the setup wizard the next time too, which you do not want. Then android studio started normally. After that start the android SDK manager and click install on the bottom right.

Hope it helps

Chris K.
  • 1,060
  • 8
  • 10
  • It's not always dangerous unless you don't know what program you are running with adminstrator rights. Please read [What precisely does 'Run as administrator' do?](http://superuser.com/a/696307/183349). – Lucky Sep 25 '15 at 11:23
  • You are right. Of course sometimes you will need to run applications as administrator/root. But all in all i will stick with saying that it is a bad habit. Android Studio does not NEED privileged rights so it should not be run as root. IMHO. (btw i am a linux user which may make a difference when talking about administrator/root) – Chris K. Sep 28 '15 at 08:33
7

Instead of using standard installation for android studio,i use custom installation and it's worked for me!!.

enter image description here

Sahir Saiyed
  • 518
  • 8
  • 17
6

In windows, I was able to get it working using the following steps:

1) Download build-tools-21.1.1 from the following link: http://dl-ssl.google.com/android/repository/build-tools_r21.1.1-windows.zip

2) In windows, the android sdk will be will be located in: C:\Users\ \AppData\Android\sdk (AppData folder will be hidden by default, you can make it visible in "Folder Options")

3) In this path - C:\Users\ \AppData\Android\sdk\build-tools, you'll already find a folder "21.1.2". In the same path, create a new folder and name it "21.1.1"

4) Unzip the package that you downloaded in step 1. Copy the contents of the folder "android-5.0" and paste it in the folder "21.1.1" that you created in step 3).

5) Run Android Studio

akashrajkn
  • 2,295
  • 2
  • 21
  • 47
5

Click Show Details while the components are downloading, it will give you more information as to what is actually happening.

In my case, it was a permission issue. To solve, I just executed the script with sudo. (sudo ./studio.sh (which will solve permission issues in the case of Linux environments). If you are on Windows, run the installation method as Administrator. (If it's a batch file, use an Administrator command prompt, if it's an executable, run as Administrator, etc..)

Alexander Kohler
  • 1,907
  • 16
  • 23
5

On Windows, solved by running this file which allowed me to update the SDK via GUI: C:\Users\%UserName%\AppData\Local\Android\sdk\tools\android.bat

Android started OK after the SDK update.

Note: running C:\Users\%UserName%\AppData\Local\Android\sdk\SDK Manager.exe did nothing on my system.

rayzinnz
  • 1,639
  • 1
  • 17
  • 17
3

This answer is for OSX

I needed to resolve two things to successfully install android studio:

  1. Ensure you aren't using proxy that is stopping you from accessing the android resources. If you are using a corporate proxy, ensure that you have the settings setup up in Android Studio > Preferences > Filter for Proxy. If you don't see the Licence Agreement (Agree/Disagree) then your connection is not reaching the google download servers
  2. Run rm -rf ~/.android. This was essential in getting this working for me. A previous install or something else had affected this download caches. Best to nuke it and start fresh.
applejack42
  • 1,155
  • 9
  • 18
2

I'm in India, and my connection was not working properly. (I have internet, but sometime I have blank page on chrome, and I need to refresh)

I tried several time to restart android studio (almost 15 times). And now it's working.

Maybe you have same problem.

Lucky
  • 16,787
  • 19
  • 117
  • 151
Johnny
  • 2,989
  • 4
  • 17
  • 28
  • 1
    Although this answer was down-voted but it actually makes sense. Internet connection must be good enough to pass that phase. – Hamzeh Soboh Jan 08 '15 at 20:36
2
  1. disable antivirus
  2. run as admin
  3. log out and start again
vuhung3990
  • 6,353
  • 1
  • 45
  • 44
2

For me, this issue was proxy related. In Mac osx, even while above error is displayed, there is menu bar for Android Studio at top. Select preferences Android Studio -> Preferences and change proxy as below and issue was resolved. There could be similar options in Windows/Linux to access preferences page while error is being displayed.

enter image description here

kiranpradeep
  • 10,859
  • 4
  • 50
  • 82
  • In MacOSX, you can still use `Command+,` ( shortcut to preferences for any application ) while error window is displayed which will open the setting page. I hope some thing similar will be there for Windows/Linux. Please downvote if there are no valid replies after posting a comment. – kiranpradeep Dec 18 '14 at 05:22
  • i agree..but there is cleary no way to change the preferences without clearing the error messages in Windows..so i thought this answer to be more specific to the other users..clearly stating the Mac OsX was missing in you answer and i read it in general.. – Lucky Dec 18 '14 at 05:34
  • That is correct. The answer was missing that mac osx part. – kiranpradeep Dec 18 '14 at 05:36
  • i have tried in ubuntu and after errors occurred i wanted to close the application by clicking x on the top left corner and it just shown me the default application window and from there i have managed to open settings of IDE and configured my proxy. I think it works for windows and MAC as well. – JIT Develop Dec 23 '14 at 06:53
  • Had to set mine to Auto-Detect. – Mattio Jul 24 '15 at 15:02
1

If are you using Linux, I noticed that the Android Studio cannot be run with JDK 8. You have to download open Jdk 7 and press alt + shift + t and type:

sudo apt-get install openjdk-7-jre 

When u have downloaded jdk 7 go to terminal then go to android-studio/bin then type

sudo sh ./studio.sh 
jww
  • 97,681
  • 90
  • 411
  • 885
Basil Battikhi
  • 2,638
  • 1
  • 18
  • 34
1

I encountered the same problem attempting to setup Android Studio from work. Running as admin didn't solve my problem, and I don't have direct access to proxy / firewall settings. In the end I resolved the issue by using the Android SDK Manager and installing the proper packages. A few of the package names and error messages (from studio install failure) didn't match up directly but a quick Google search showed me the light.

Hope this helps!

IdusOrtus
  • 1,005
  • 1
  • 16
  • 24
  • Yup, this did worked. I had firewall/proxy problem which prevented Android studio from connecting to internet. But **Android SDK Manager** was able to connect to internet and download. Installing appropriate packages solved the issue. – Carbine Jan 28 '15 at 07:08
1

Finally I able resolve this issue.

Do not install Android SDK with studio package, unkcheck the option when asked.

Steps to resolve:

  • Download latest android sdk, so while runnning studio first time it has not to download any exta packages. Unpack at /yourAndroidSDKPath
  • Uncheck option, Android SDK, while installing studio.
  • Give the /yourAndroidSDKPath in studio installation when asked. It works for me.

I tried other solutions, run as Administrator and proxy setting but nothing worked.

Anoop
  • 456
  • 3
  • 5
  • 15
1

Update latest android sdk tools from sdk manager and removing proxy that I did input for connecting Android studio with vpn worked for me.

Eftekhari
  • 1,001
  • 1
  • 19
  • 37
0

I have a proxy in my connection (university connection) and I solved the problem by using the SDK manager to download the SDK packages then I opened android studio and it worked seamlessly.

Med Zamrik
  • 303
  • 2
  • 5
  • 14
0

I also had issues with OS X Yosemite on a fresh install of Android Studio.

My situation was that I was using a VPN. In the preferences, I ended up setting the HTTP Proxy setting to detect automatically after trying running it as sudo and setting a static proxy setting, but neither worked. I was able to download successfully after that. Hope this helps someone with a similar situation (VPN).

Android HTTP Proxy Settings

Grant
  • 1,822
  • 1
  • 21
  • 30
0

One possible solution is to open Android SDK Manager from

C:\Users\%user%\AppData\Local\Android\sdk

Check Android SDK build tool 21.1.1 download and install. Restart Android Studio

Lucky
  • 16,787
  • 19
  • 117
  • 151
Muhammad Aamir Ali
  • 20,419
  • 10
  • 66
  • 57
0

On OSX (Yosemite), I was having the same issue. After trying several of the other answers, I changed the install directory files to be owned by me:

cd /Applications/android-sdk-mac_x86

chown -R *

Where is my user account.

The problem I had with doing the root install is that some files were ending up in the root account home directory and others in mine once I started using Android Studio.

Community
  • 1
  • 1
EPage_Ed
  • 1,173
  • 11
  • 11
0

I used custom installation instead of standard and that solved the issue! (just select custom and you can then install everything like the standard)

kakhkAtion
  • 2,264
  • 22
  • 23
0

For OSX (Mac)

I tried install as Administrator (sudo) but it's did not work


After that I solve the problem by this,

when setup, select custom setup instead of standard setup

then, it will solve this problem

Sruit A.Suk
  • 7,073
  • 7
  • 61
  • 71
-1

A little late but I was having this problem too and running studio as root just created more problems (using OSX here).

I fixed it by manually installing what was failing to install using the Android SDK manager. Just run android sdk in a terminal (probably the same on Windows but don't quote me). Let it install all the updates it wants, then if you can't make it through the setup, manually find the packages that are failing to install and install them.

Got me through a very frustrating problem and back to work.....

jamzsabb
  • 1,125
  • 2
  • 18
  • 40
-2

"The following SDK components were not installed: sys-img-x86-addon-google_apis-google-22 and addon-google_apis-google-22".

I would suggest just close the window instead of clicking Finish and select not to run the setup wizard.

Community
  • 1
  • 1
Dhruv
  • 165
  • 1
  • 7