1

i'm on a Windows 7 Pro x64 with java jdk 7u7.

I try to install the Android SDK on my computer, but when i launch SDK Manager.exe, a dos-windows is opening and instantly closing. So i tried to launch tools/android.bat. But that didn't work, it say to me that :

"'C:\PROGRA~2\Android\ANDROI~1\tools\lib\\find_java.exe -s' isn't a external or internal command ...

ERROR No suitable java such ..."

What i have do for fix error :

  1. Install Java 6u35
  2. Install Java x32 and x64
  3. Check my path
  4. Launch in administrator
  5. Install in C:\Dev the sdk
  6. Install with android-sdk.zip or with android-sdk.exe
  7. Add android directory in path

But anyone of this try was successful. Someone can help me?

Renjith
  • 5,783
  • 9
  • 31
  • 42
LBull
  • 11
  • 1
  • 1
  • 2

7 Answers7

5

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).

Dan Puza
  • 511
  • 6
  • 9
0

I had this answer just this week and have determined what is causing it.

When Java updates it changes the path where the executable files are stored. This means that when the SDK manager goes to look up javaw.exe it cannot find it and instantly closes.

Therefore re-installing the Android SDK will NOT solve the problem. Neither will re-installing JAVA.

The only way to solve this problem is to correctly point to the location where JAVA is stored.

Windows has a way of doing this called an Environmental Variable. There is a variable called PATH which stores all the directories where Windows will look for executable files.

Thus you have to to modify that PATH variable to include a path to JAVA. By default JDK 7 has the following path:

C:\Program Files\Java\jdk1.7.0_10\bin

To edit your Environmental Variables do the following.

From the Start Menu right click on Computer and select "Properties"
This will take you to the Control Panel System Menu
On the left column look for the option "Advanced System Settings"
This will open a System Properties window
One of the tabs is named Advanced
In that there is a button that says Environmental Variables
If you search your System Variables you will see one called "Path"
Edit that variable and add the path above to include the latest Java Path.

Once you are done the SDK Manager should immediately be able to open up and you can continue updating to the latest revision of the Android SDK.

Once the updates complete don't forget to make sure your IDE (ie Eclipse) is pointing to the correct location where the SDK is stored so that it reads the latest Android SDK files. To access this setting in Eclipse, go to Window -> Preferences -> Android

This will allow you to manually set the path where the SDK is stored.

0

The only thing that helped me was reinstalling java into a path that did not contain any spaces, so instead of C:/Program Files to C:/Java and change the Path variable to the new value.

Hope this helps.

Analizer
  • 1,594
  • 16
  • 30
0

I had the same issue and it's most likely caused by spaces in the path names. It's known that spaces in path names and batch files don't combine well together.

You can verify that by opening a command line prompt, changing the location to %SDK%\tools\lib and running find_java.bat. You will get an batch error like

'C:\PROGRA~2\Android\Android' is not recognized as an internal or external command, 
operable program or batch file.

Just install the SDK into C:\Android\SDK and the NDK into C:\Android\NDK and it will work.

ViRuSTriNiTy
  • 5,017
  • 2
  • 32
  • 58
0

This is how I finally fix it open tools/android.bat

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

replace it with your java path

set java_exe="c:\PROGRA~1\Java\jdk1.7.0\bin\java.exe" 

Note: Do not use C:\Program Files\Something it throw an error because of the space use the short name notation C:\PROGRA~1\Something

and it will work like charm

benaich
  • 912
  • 11
  • 29
0

Same issue for me SDK Manager.exe just stopping with no error message or windows event.

I fixed this with a hybrid of the already provided answers (I'm running on Win 8.1). The problem appears to be that the java.exe targeted by find_java was out-of-step with the recently installed JDK version.

for me:

  • <sdk> was C:\Users\Simon\AppData\Local\Android\sdk
  • <jdk> was C:\PROGRA~1\Java\jdk1.7.0_80\bin

    1. I added my JDK install path to the PATH environment variable e.g. ...;C:\PROGRA~1\Java\jdk1.7.0_80\bin;...
    2. After opening a new command window and running find_java.bat in the <sdk>\tools\lib\ folder I noticed that the java_exe env variable was set was to C:\Windows\System32\java.exe which was not what I expected.
    3. I deleted (well renamed) the java.exe in C:\Windows\System32
    4. I ran find_java.bat again and now the java_exe env variable was set to java_exe=<jdk>\java.exe as expected.
    5. Then in <sdk> I could run SDK Manager.exe successfully.
Simon Sanderson
  • 2,939
  • 2
  • 19
  • 11
-1

Changing the JAVA_HOME from existing pointing to a JDK path to a JRE path works for me.

Tai Li
  • 51
  • 1
  • 1
  • 4