YMMV, but in addition to editing android.bat, as described in the previous answer, I still couldn't get the SDK Manager to run on Windows 8 64-bit, until I first:
- uninstalled ALL versions of Java
- rebooted*
- installed ONLY the X86 JDK (including the Public JRE option in the installer)
I had tried all of these things and more previously *WITHOUT rebooting, and this was the only way I ever got the SDK Manager to run. Hopefully this info saves you from some of the utter frustration and wasted time I experienced. What a pain in the ass just to get the tools running out of the box. Awful experience.
I would have replied as a comment to the previous answer, but apparently I don't have enough rep to do that: https://meta.stackexchange.com/questions/25725/how-do-you-comment-on-a-specific-answer
EDIT: More complete answer below. (I don't think rebooting had anything to do with it.)
There appear to be several ways to launch the SDK Manager:
SDK Manager.exe
in the root of the Android SDK.
SDK Manager.exe
in sdk\tools\lib
of the Android SDK.
Window -> Android SDK Manager
menu in Eclipse
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:
- Uninstall ALL versions of Java
- 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.
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).