226

So I installed the android sdk for Windows:

http://developer.android.com/sdk/index.html (the installation link)

And ran into the path variable problem. So I fixed that by changing "PATH" in enviroment variables to include where my java.exe file is located from the JDK.

But now when I open the android sdk manager, a cmd-like screen just briefly flashes on for half a second then disappears. I have no idea what's going on and how to get this thing working.

4
  • @user624869: What version of windows are you running?Also, what is the 'path variable problem' you mention?
    – Squonk
    Mar 4, 2011 at 23:10
  • 53
    Try starting the SDK from command prompt by using android.bat in the tools folder.
    – Alpine
    Mar 23, 2011 at 19:11
  • Also See
    – Alpine
    Mar 23, 2011 at 19:28
  • 2
    There should be a detailed explanation post about all these kind of java path, sdk path, sdk/avd manager not showing, administrator right, android.bat.. which problems occur because of dynamic binding of related pathes. Apr 25, 2013 at 20:40

29 Answers 29

268

Make sure your java\bin directory is in your path statement before the windows\system32 directory. The SDK Manager uses java and it was finding the one in the system32 folder.

In a CMD window, you can run 'where java'. Don't forget to restart your CMD after changing the path variable for checking.

11
  • 11
    Can you be more specific ? I don't know where is my java\bin, is that C:\Program Files\Java\jdk1.7.0_11\bin ? What "before the windows\system32 directory" means? And what is the point of running "where java" in CMD ? Jan 21, 2013 at 1:54
  • 40
    OK I figured it out. In my case it means going to Computer -> Advanced system settings -> Environment variables -> PATH -> edit: make sure they are in this order: C:\Program Files\Java\jdk1.7.0_11\bin;%SystemRoot%\system32;.... Jan 21, 2013 at 2:23
  • 9
    Should I use JDK bin or JRE bin?
    – Peterdk
    Apr 29, 2013 at 21:56
  • 5
    @Peterdk JDK. Anything that cares will prefer the JDK. Anything else won't be fussed. Sep 25, 2013 at 1:44
  • 4
    Still i can't open sdk Manager by change the environment path.
    – Yog Guru
    Jul 10, 2015 at 18:43
184

Alright, I had the same problem, and none of these answers worked for me (I'm running Windows 8). I tried running tools/android.bat and noticed I got some errors there. I investigated further and it seems there is something wrong in the code that finds your Java path.

This is how you fix it:

  1. Open up tools/android.bat in your favorite text editor
  2. Search for this piece of code:

    set java_exe=
    call lib\find_java.bat
    if not defined java_exe goto :EOF
    
  3. Replace it with this:

    set java_exe=D:\Program Files\Java\jdk1.7.0_07\bin\java.exe 
    

    where the path is the path to your Java exe.

  4. Run android.bat

(in my case I had to specify the path to java_exe in step 3 with no quotes to make it work.)

9
  • 7
    I am also running Windows 8 and having the same issue as the original poster. Just like teuneboon, none of the other solutions worked for me except this one. Thanks teuneboon!
    – Raddfood
    Jan 1, 2013 at 19:59
  • 3
    @teuneboon thanks for this solution. And I've found out that this happens only when you have placed your android SDK in any folder/path that contains spaces.
    – PC.
    Jan 10, 2013 at 11:34
  • @PC. It means if I rename android SDK parent folder then this problem solved?
    – Deepak
    Feb 8, 2013 at 6:35
  • @Deepak yes, all you have to take care is that there should not be any spaces in the full path.
    – PC.
    Feb 8, 2013 at 6:42
  • 1
    @PC. Sorry but it doesn't help me, I found this link and this worked for me stackoverflow.com/a/7567354/1250370.
    – Deepak
    Feb 8, 2013 at 7:16
29

There are many reasons as to why the SDK Manager won't open. Rather than trying each one of them blindly, I recommend running the android.bat in a command window so you can read the error message and apply the correct fix.

1
  • I ran android.bat in cmd, and it said "xcopy is not recognized as an internal or external command"; so I defined the path to System32 folder (which contains xcopy.exe) in Environment Variables -> PATH, and now it works. thanks
    – Ehsan
    Jun 30, 2020 at 16:25
22

In the latest version of the Android SDK, running "SDK Manager.exe" and/or "AVD Manager.exe" will not open anymore. Even the "Launch Standalone SDK Manager" link in Android Studio, which can be previously found in Android SDK Settings, is now gone.

It is now recommended to perform manual SDK and AVD management inside Android Studio. But for those who do not have an Android Studio or for those who do not like to open Android Studio just to perform SDK management, you can still manage the SDK using the command line tools, "tools/bin/sdkmanager.bat" and "tools/bin/avdmanager.bat".

This information is available when running "tools/android.bat". I think this is true for those who currently have Android SDK tooks v25.3.1 and above.

4
  • Is there any way to fix the problem rather than just work around it via the command line tools? Apr 6, 2017 at 1:48
  • While this is not the answer to the question, I had to upvote this for visibility, because the SDK Manager.exe doesn't exist in the latest SDK downloads, for some reason. Could be to package everything within Android Studio. In fact, @bmdelacruz's answer is basically what Google says here: developer.android.com/studio/intro/update.html#sdk-manager Jun 5, 2017 at 20:05
  • My eclipse Luna was working good I added some later sdks and it worked and submitted my App, now I want to make some changes it does't open anymore I tried the the sdkmanager a whole bunch of errors pop but still does not load
    – becker
    Nov 1, 2018 at 3:06
  • There are too many error while running sdkmanager.bat too handle!
    – Ghasem
    May 20, 2019 at 6:34
19

Same problem here. Fixed! I installed the correct Java stuff, all for 64 bit, because my system is x64, and nothing happened. So I went to C:\Users\[my name] and deleted the directory .android that has been created the first time the SDK ran, apparently with some wrong configuration.

Then it worked. You can try that. Delete that folder or just move it to the desktop and run the SDK.

0
17

Google removed the GUI for SDK starting from version 26. If you're using version 26, try downgrading to version 25. You can still open the SDK from Android Studio.

Source: Is GUI for Android SDK manager gone?

0
15

There appear to be several ways to launch the SDK Manager:

  1. SDK Manager.exe in the root of the Android SDK.
  2. SDK Manager.exe in sdk\tools\lib of the Android SDK.
  3. Window -> Android SDK Manager menu in Eclipse
  4. android.bat in sdk\tools of the Android SDK.

In my case, it looks like android.bat fails on the line:

for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a

As far as what that line is doing... if I manually run: "[path_to_java]java" -jar lib\archquery.jar

It successfully returns: x86_64

But when the batch file runs that same command, I don't know why but it fails with the error message:

Unable to access jarfile lib\archquery.jar

So the variable swt_path gets set to an empty string. Everything breaks down from there.

The batch file sets the correct value for the variable java_exe. Others have commonly reported this as a problem, but those workarounds weren't relevant in my case.

People have recommended commenting out the problem line by adding REM to the beginning of it, and adding a line to manually set the swt_path variable, which is a valid workaround:

REM for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a
set swt_path=lib\x86

BUT, the critical issue in my case is that it's choosing to load a jar file from either the lib\x86 or the lib\x86_64 folder here. At some point, things were getting confused between the BAT file error, a 32-bit JDK, and a 64-bit Android SDK.

SO, the workaround in my case was to:

  1. Uninstall ALL versions of Java
  2. Install the JDK
    • You can either use the 32-bit Android SDK and install the 32-bit JDK
    • Or use the 64-bit Android SDK and install the 64-bit JDK
    • But the "bitness" of the JDK should match the Android SDK. It appears that either of the 32-bit or the 64-bit will work on a 64-bit computer, AS LONG AS the JDK bitness matches the Android SDK bitness.
  3. Edit "android.bat"

    • If using the 32-bit Android SDK/JDK, use lib\x86:

      REM for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a
      set swt_path=lib\x86
      
    • If using the 64-bit Android SDK/JDK, use lib\x86_64:

      REM for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a
      set swt_path=lib\x86_64
      

After doing this, I can successfully run the SDK Manager by running android.bat, or from the Eclipse menu (but still not by running either of the SDK Manager.exe files directly).

3
  • Please don't post the same answer to multiple questions. If the questions are the same, leave a comment or flag them as duplicates. If they are not the same, then please tailor your answer to the question asked. Mar 13, 2013 at 16:28
  • my android.bat launches the sdk manager but sdk manager.exe not .It diaplays error android.bat not found .Can you help me?
    – Ankita
    May 28, 2015 at 6:04
  • You can set ANDROID_SWT=lib\x86 or lib\x86_64 before running android.bat to specify the swt_path. Sep 12, 2015 at 15:58
13

The simplest way is to run the program as administartor.

Right-click the SDK Manager -> Run as Administrator

That should solve the problem :)

1
  • 2
    Indeed solved the problem. This is the best solution. If you want to set this behave by default, check the flag "Execute this program as administrator" in the Compativility tab of the file properties.
    – Corbella
    Nov 6, 2013 at 11:41
9

I had the same problem, tried setting path variables and everything. What SDK manager needs is not the JDK, but the actual Java SE end user crap. Go to http://www.java.com/en/download/ie_manual.jsp?locale=en and download that. As soon as I finished installing that, it worked like a charm

0
8

Try adding the Java path (pointing to the JDK) to the System Environment Variables.

Right-click 'Computer' > Properties > Advanced system settings > Environment Variables

Then under System Variables, add a new variable.

Variable   Value
JAVA_PATH  C:\Program Files\Java\jdk1.7.0

Then edit the Path variable, prefix it with %JAVA_PATH%\bin;.

7

Locating the android.bat file in the tools folder worked for me. Funny that it is such a chore to get it to run. In my experience, usually .exe files run as expected. I'm not sure why it doesn't in this case... strange and annoying!

6

I had something totally different than the other answers.

I ran tools/android.bat and got

java.lang.NullPointerException
        at java.io.File.<init>(File.java:251)
        at com.android.sdklib.internal.avd.AvdManager.parseAvdInfo(AvdManager.java:1623)
        at com.android.sdklib.internal.avd.AvdManager.buildAvdList(AvdManager.java:1584)
        at com.android.sdklib.internal.avd.AvdManager.<init>(AvdManager.java:357)
        at com.android.sdklib.internal.avd.AvdManager.getInstance(AvdManager.java:380)
        at com.android.sdklib.internal.repository.updater.UpdaterData.initSdk(UpdaterData.java:259)
        at com.android.sdklib.internal.repository.updater.UpdaterData.<init>(UpdaterData.java:127)
        at com.android.sdkuilib.internal.repository.SwtUpdaterData.<init>(SwtUpdaterData.java:61)
        at com.android.sdkuilib.internal.repository.ui.SdkUpdaterWindowImpl2.<init>(SdkUpdaterWindowImpl2.java:104)
        at com.android.sdkuilib.repository.SdkUpdaterWindow.<init>(SdkUpdaterWindow.java:88)
        at com.android.sdkmanager.Main.showSdkManagerWindow(Main.java:408)
        at com.android.sdkmanager.Main.doAction(Main.java:391)
        at com.android.sdkmanager.Main.run(Main.java:151)
        at com.android.sdkmanager.Main.main(Main.java:117)

Basically it looked like I had a corrupt AVD configuration, so I went and cleared out my virtual devices and everything started working again! (Files in C:\Users\YourUser\.android\avd for windows users)

1
  • Should be the top most answer. Had a power outtage while starting a VM and AVD and SDK was dead afterwards. I deleted only the last used VM and it works again! Thanks! - For those who can't afford to delete an entire VM, please look into the .ini file on the affected VM (if you ain't sure, look into every one). If it's empty (my case) or garbled, replace it with a working .ini (from another VM for example) and replace the text inside accordingly. WIth a little bit of luck, it'll start again.
    – Fusseldieb
    Jul 10, 2020 at 16:21
4

I faced the same issue and finally managed to solve it. I then created a step-by-step guide containing the universal fix to help all developers get past this issue asap: http://www.dominantwire.com/2015/03/android-sdk-not-opening.html

All the steps in short:

1.If you have jdk v1.8. Remove it and re-install jdk v1.7.x.x

2.Set paths to jdk and jre bin folders in the environment variables

3.delete (make a backup first) the .android folder present in C: > Users > [user-name] > .android

4.Set the JAVA_HOME variable keeping JAVA_HOME as the variable name and the path to bin folder of jdk as the variable value.

5.Go to [sdk-directory] > tools. Find and right-click on android.bat file and select 'edit' to open it in notepad and make the following modifications.

ORIGINAL

set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF

MODIFIED

set java_exe=C:\Program Files\Java\jdk1.7.0_75\bin\java.exe
rem call lib\find_java.bat
rem if not defined java_exe goto :EOF

NOTE : Copy and paste your own java.exe path directory as explained previously.

ORIGINAL

for /f "delims=" %%a in ('"%java_exe%" -jar lib\archquery.jar') do set swt_path=lib\%%a

MODIFIED

rem for /f "delims=" %%a in ('"%java_exe%" -jar lib\archquery.jar') do set swt_path=lib\%%a
set swt_path=lib\x86_64

NOTE : If your android sdk is 64bit then mention set swt_path=lib\x86_64 otherwise if it is 32bit then keep it as set swt_path=lib\x86

  1. Done! Fire up android sdk from android.bat file or from eclipse. It should open up just fine!
1
  • My android.bat launches the sdk manager but sdk manager.exe not .It diaplays error android.bat not found.Can you help me?
    – Ankita
    May 29, 2015 at 6:44
4

I tried almost all the solutions provided here. But nothing worked out. And finally, I downloaded tools(tools_r25.2.3-windows.zip) from the below link and replaced the tools sub-folder in the sdk folder. It started working.

https://developer.android.com/studio/index.html#downloads

Sharing this as an information though it's an old thread.

1
  • 3
    replacing the tools folder inside the SDK directory with the downloaded & extracted tools_r25.2.3-windows.zip has also solved my issue, but the directed link is updated with the latest tools, which didn't solve that. I downloaded the ZIP directly from here: dl.google.com/android/repository/…
    – Touhid
    May 20, 2017 at 19:17
3

I recently faced this problem after I installed android emulator using the sdk manager of android studio - which also upgraded my android sdk tools to 26.0.1 (as it was a prerequisite - according to the sdk manager of android studio).

In my case, I simply replaced the tools folder of android sdk with tools folder from an older android sdk. This downgraded the android sdk tools, but now I can open the sdk manager using SDK Manager.exe.

4
  • 1
    Hi, I think my problem started after upgrading to 26 too. How do you get the older android sdk tools? Jun 2, 2017 at 11:20
  • Option 1. If you have android studio installer (preferably older version android studio) bundled with android sdk, you can choose to install both android studio and android sdk - then replace the already existing sdk's tools folder with the newly installed sdk's tools folder.
    – Muntasir
    Jun 2, 2017 at 13:30
  • 1
    Option 2. You can visit here or here to download older android sdk tools. (you can find some old sdk tools here as well, but those tools are too old)
    – Muntasir
    Jun 2, 2017 at 13:33
  • Thank you, this is a serious bug from the Android team. The 26 version has many missing files! Downgrading to previous sdk tools worked. Jun 5, 2017 at 3:18
2

Also make sure there is not as JRE before your JDK in PATH on Windows. Oracle always stuffs its own JRE into the path before anything else (I had installed Oracle Lite after I installed the android sdk).

2

Same problem here, I tried all solutions but nothing worked. Then I went into C:\Users\User_name and deleted the ".android" folder and then, the SDK Manager could open normally, and automatically created other ".android" folder.

0
2

I have solved this issue. If you are not able to open "SDK Manager.exe" from explorer or if you are facing any problem with SDK Manager.

Firstly check Java path is given in Environment Variable. (run Java command on CMD, or run Where Java on CMD as Administrator). If Java command is recognized, there might not be problem with Java

This might be due to broken SDK Tools. To fix it firstly rename tools folder (Android\Sdk\tools) to tools.old. Now download https://dl.google.com/android /repository/tools_r25.2.3-windows.zip?hl=id. After that Extract the downloaded zip files to Android\Sdk\ hence new tools folder would be extracted with all the contents for SDK. Now open SDK Manager.exe. If it opens your issue is solved. Please note that SDK Manager.exe is a launcher file that launches Android\Sdk\tools\bin\sdkmanager.bat. if you are satisfied with the answer please Upvote so that maximum users would solve the issue. For further help visit this page https://answers.unity.com/questions/1320150/unable-to-list-target-platform.html

2

Been trying to get the SDK manager to run for a while now following various threads with similar problems I could find.

Another solution to consider is to move android SDK to a dir without spaces in its name.

For instance in my case it resided in:

e:\Program Files (x86)\Android\android-sdk\

and would fail. When moved to:

c:\android_sdk_sucks\

It worked.

1
  • In this case you can use inverted commas when the space is in folder like this. "e:\Program Files (x86)\Android\android-sdk\" Jul 5, 2012 at 7:36
1

I tried all the most popular solutions before and no one worked for me, until I realised that the Android SDK folder must not have any spaces, so I changed it from "C:\Android SDK" to "C:\Android_SDK". As simple as that.

1
  • I think it's the space in the path. I used C:\Programs instead of C:\Program Files and it worked. And this is for v3.01 four years later! I feel like I'm in the 90s again.
    – ssimm
    Feb 8, 2018 at 9:25
1

Nothing helps me from all this answers, but I found the right steps (Windows 7 64 bit):

1) Open android.bat from your sdk folder for editing;

2) Add exactly this two strings:

set java_exe=c:\Program Files\Java\jdk1.8.0_25\bin\java.exe
rem call lib\find_java.bat

instead of this:

set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF

Where c:\Program Files\Java\jdk1.8.0_25 is your jdk folder. 3) Enjoy. SDK Manager will launch from Android studio IDE.

1

I installed Android Studio for Mac. I was not able to access the SDK manager through the IDE. It turns out I just had to have my JAVA_HOME environment variable set. Once I got this set I was able to launch the SDK manager.

0

I'd encountered the same problem. When running the android.bat I found the solution (if Java is installed in the 'normal' Windows directory, ie 'program files') you need to put quotes surrounding "c:/program files/" etc etc. Otherwise it cannot find java on "C:/program". (me dislikes spaces)

0

The issue with mine was that I could run SDK manager through double clicking android.bat but not when I double click on the actual SDK manager application. I solved this issue by setting a new environmental variable:

ANDROID_HOME = C:\Development\adt-bundle-windows-x86_64-20130911\sdk\

restarted my pc and now I can double click on the application and run SDK Manager. Hope that helps :)

1
  • I am also getting the same problem but not able to solve by the solution you gave
    – Ankita
    May 29, 2015 at 6:34
0

I saw answers that provide workaround solutions by hard coding java.exe location and x86 / x86_64 architecture string in sdk\tools\android.bat. Those are quick solutions but did not solve the fundamental issue that I am actually curious of.

The actual problem that I encountered is, the batch script is not able to find another script/jar file and thus is failed to proceed. I could say the script was poorly written.

After I made the following changes in sdk\tools\android.bat, everything works like a charm.

Specifically, I added %~dp0\:

set java_exe=
call %~dp0\lib\find_java.bat
if not defined java_exe goto :EOF

...

for /f "delims=" %%a in ('"%java_exe%" -jar %~dp0\lib\archquery.jar') do set swt_path=lib\%%a

Now, try to launch the script and SDK Manager should come out.

p.s. My installation of OS, Java 8 and Android SDK are fresh and I did not do any of the extra configuration.

p.s. You may still need to configure PATH environment variable so that the script could find the suitable java.exe.

0

I test every way, But only working way was re Installing sdk-manager in same path as old one

0

http://quantumsupport.blogspot.com/2011/03/android-sdk-managerexe-wont-start.html

Create a new user account, either re-install or just start android.bat and it should work did for me

1
  • 1
    I just don't see how this is a good option. I don't have access on my machine ( a work machine ) to create a new user account. What user settings exist that need to be deleted? Aug 19, 2011 at 20:57
0

I encountered a similar problem where SDK manager would flash a command window and die.

This is what worked for me: My processor and OS both are 64-bit. I had installed 64-bit JDK version. The problem wouldn't go away with reinstalling JDK or modifying path. My theory was that SDK Manager may be needed 32-bit version of JDK. Don't know why that should matter but I ended up installing 32-bit version of JDK and magic. And SDK Manager successfully launched.

0

OS: Windows 7- 64 bit, Android SDK: 64 bit

  1. Introduce a new 'System variable' named: JAVA_HOME with value: C:\Program Files\Java\jdk1.7.0_51

  2. Right-click on SDK Manager.exe -> Run as administrator

A check list:

  • Make sure the java path in system variable 'Path' is something like: C:\Program Files\Java\jdk1.7.0_51\bin
  • There is no space in your folder name, replace something like C:\Android SDK with C:\Android_SDK
  • You can find your java with 'where java' command in command line

Not the answer you're looking for? Browse other questions tagged or ask your own question.