1

I've been trying to fix this for the last 48 hours, and it is driving me insane.

My SDK Manager.exe flashes a cmd screen and closes in less than a second.

After much searching, I finally managed to get my SDK Manager to open after adjusting android.bat, and running it as administrator.

But, SDK Manager.exe was not able to find android.bat so I copied it into the android-sdk folder.

SDK Manager.exe is now able to find android.bat, but it is still briefly flashing cmd and then closing.

My PATH variable has my jdk java.exe directory as the first entry, and I have restarted and reinstalled several times.

What is causing this? Why am I able to open the manager from android.bat, but not from the executable?

I am trying to configure Eclipse to use the SDK Manager, but obviously I cannot because the executable refuses to open.

Eclipse is also telling me that adb.exe is missing, and upon checking platforms I have confirmed this. I assume adb.exe will be installed from the SDK Manager?

Edit: After thinking about it, I think the issue may be with the permissions of android.bat. It must be run as administrator in order to work, otherwise if opened regularly it will say "Access is denied".

Is it possible to change this? Looking in the properties of android.bat, I have adjusted my account to have full control. This has not affected the issue, though.

tshepang
  • 12,111
  • 21
  • 91
  • 136

6 Answers6

1

I've experienced this on some machines, but not others. It's a strange problem and I believe it has to do with a path problem in one of the android files (android.bat?).

Why this happens on some installs and not others I have yet to figure out. I've read everything I could find both here and on the interweb, tried many different solutions, including installing another version of JDK 6 and 7, modifying the path variable, adding a JAVA_HOME variable, etc. and none worked.

This worked for me in Windows 7...

1) Add a copy of the "SDK Manager.exe" file INSIDE the SDK folder (so it's next to the tools, platforms, et. al folders) and then run it. You will still see the command window "flash" for a second and then disappear, but be patient and the SDK manager WILL show up.

2) Create a shortcut to this "inside" copy of the SDK Manager.exe and move it where ever you want; it now knows where to go to find the files and works every time. I have a copy on my desktop, but it doesn't matter where you put it.

Note: There's still a problem somewhere, and it may have to do with Google, but it seems to happen to some people regardless of what/when they do an install, while others have no issues at all.

This may not be the answer we need to get Google to fix it, but it works without uninstalling/reinstalling java or the SDK, modifying/adding variables, modifying android.bat, changing your path, running as admin, etc., and the best part is it's easy. It's too bad many of us have wasted hours of time on trying to fix it.

Good Luck!

Note: I added the comment below about x64 machines. It's strange, but when we tried it on one x64 (OS/ADT) machine and it didn't work. I just tried a fresh install of Java 7 x64, and ADT x64 on a machine where it was working with a 32bit install (meaning I now have both 32bit and 64bit installs of Java and ADT on the same machine) and again, it works fine. A brief flash, it goes away, and then the SDK manager opens as expected. The mystery continues. :)

Zeus56
  • 1,861
  • 14
  • 9
  • One more point. I was able to fix this on a 32bit Android install (on top of a Win7 x64 OS), but it did not work on another Win7-x64/Andoird-x64 machine. Not sure if it's related. – Zeus56 Mar 19 '13 at 13:31
  • Thanks for your answer Zeus. I got fed up with it and did a complete reinstall of my JRE, JDK and Eclipse, but this time using the ADT Bundle. Fixed the problem. –  Dec 07 '13 at 06:48
1

I had the same problem when I updated my android SDK tools to 23.0.2. Spent a lot of time (around 6 hours) messing around trying to find a fix... and I found it, but still not sure how it all works.

It has to do with android.bat file in the tools folder of your android SDK directory, in the lines:

set java_exe=
call lib\find_java.bat

I modified the lines into the following values:

set java_exe=pathwhereyoufindjavaexe
REM call lib\find_java.bat

Basically, two things are done:

  1. Set your java_exe variable to your Java.exe path

  2. Delete, or comment the line: "call lib\find_java.bat"

I commented second line so it DOESN'T re-set my java_exe variable through find_java.bat, and manually set my java_exe variable to where my java.exe file is. If you don't know where (or forgot where) your java.exe is, try using windows search for it.

My path for java.exe is different from the one found using find_java.bat. My Actual path:

U:\PortableApps\CommonFiles\Java\bin\Java.exe

The path find_java.bat sets it to:

C:\Windows\systems32\java.exe

NOTE: I figured what path "call lib\find_java.bat" sets the java_exe variable through adding the following command below the line itself:

echo %java_exe%
pause

I'm not sure if this is some sort of permission or access error, or this solution worked only for me since my java JDK is on USB device or such. Well, if anyone else bump into this problem, give my solution a try and see if it works for you guys as well.

Oniisaki
  • 21
  • 1
0

I don't know if it will solve your problem but make sure you have installed jre and jdk and android sdk for the same bit system (I mean that all three are for 32 or 64 bit systems). I once had an android problem based on this! If you use them for one system try to reinstall them. I had a similar problem and it worked after changing all versions to 64 bit. Hope I could help you.

j0chn
  • 1,103
  • 1
  • 7
  • 13
  • Hey thanks for answering. I downloaded the sdk from here: http://developer.android.com/sdk/index.html I did not download the adt bundle, only the tools. It looks like there is only one version so I don't think it is a bit system issue. –  Feb 23 '13 at 09:16
  • Than I can't help you. Sorry mate! – j0chn Feb 23 '13 at 09:57
0

When you 'Run as administrator' the current directory gets changed because you are impersonating another user. To prove this put the following line at the top of your bat file:

echo.CD=%CD% & pause

Then execute your bat file as a normal user and observe result.

Now execute bat file via 'Run as administrator' and note that CD has been changed to C:\Windows\system32 (typical).

The fix is simple. Put the following line in your bat file to restore the current directory:

pushd %~dp0

It needs to be before you reference any files/folders. I typically put that line near the top of all bat files that may be 'Run as administrator'. It does not hurt anything if used for older (XP) OS's.

RGuggisberg
  • 4,630
  • 2
  • 18
  • 27
  • Thanks for your response RGuggisberg. The two directories were indeed different, but unfortunately adding pushd %~dp0 did not make a difference when running SDK Manager.exe. –  Feb 24 '13 at 02:57
0

I had the same issue!

I had installed the ADT bundle 64-bit, so I downloaded Java 64-bit. I messed around with paths and things, but the thing that fixed it in the end was installed Java 32-bit.

The easy fix is to install both versions. You can download them manually here.

Good luck!

vittorio88
  • 68
  • 6
0

I had same problem with Windows 8.1 64-bit and JDK8. I uninstalled JDK8x64 and installed JDK8i586 and now it works like a charm.

Amir Bilal
  • 447
  • 3
  • 7