Android SDK Manager will not run - android

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 :
Install Java 6u35
Install Java x32 and x64
Check my path
Launch in administrator
Install in C:\Dev the sdk
Install with android-sdk.zip or with android-sdk.exe
Add android directory in path
But anyone of this try was successful.
Someone can help me?

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

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.

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.

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.

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

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
I added my JDK install path to the PATH environment variable e.g. ...;C:\PROGRA~1\Java\jdk1.7.0_80\bin;...
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.
I deleted (well renamed) the java.exe in C:\Windows\System32
I ran find_java.bat again and now the java_exe env variable was set to java_exe=<jdk>\java.exe as expected.
Then in <sdk> I could run SDK Manager.exe successfully.

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

Related

'apkanalyzer' is not recognized as an internal or external command

I often compare my new build apk size with the production build and I am looking for options to automate this activity such that it compares both new and prod apk sizes and reports me.
I am aware of APK Analyzer of Android Studio but I want to do that using command-line tools. This doc lists the usage of apkanalyzer but upon running this command
apkanalyzer -h apk file-size myapk.apk
It says "'apkanalyzer' is not recognized as an internal or external command, operable program or batch file." though I have already set the environment path to \Android\sdk\tools\bin.
Not sure why command-line is not recognizing this command, could you let me know where I could possibly have gone wrong or is there any other way to check apk file size using command-line?
Thanks for any help in advance.
apkanalyzer is unix shell script, here converted batch script for windows, make sure to change APP_HOME and CLASSPATH to match your setup. save it as apkanalyzer.cmd
#echo off
::##############################################################################
::##
::## apkanalyzer start up script for Windows
::##
::## converted by ewwink
::##
::##############################################################################
::Attempt to set APP_HOME
SET SAVED=%cd%
SET APP_HOME=C:\android\sdk\tools
SET APP_NAME="apkanalyzer"
::Add default JVM options here. You can also use JAVA_OPTS and APKANALYZER_OPTS to pass JVM options to this script.
SET DEFAULT_JVM_OPTS=-Dcom.android.sdklib.toolsdir=%APP_HOME%
SET CLASSPATH=%APP_HOME%\lib\dvlib-26.0.0-dev.jar;%APP_HOME%\lib\util-2.2.1.jar;%APP_HOME%\lib\jimfs-1.1.jar;%APP_HOME%\lib\annotations-13.0.jar;%APP_HOME%\lib\ddmlib-26.0.0-dev.jar;%APP_HOME%\lib\repository-26.0.0-dev.jar;%APP_HOME%\lib\sdk-common-26.0.0-dev.jar;%APP_HOME%\lib\kotlin-stdlib-1.1.3-2.jar;%APP_HOME%\lib\protobuf-java-3.0.0.jar;%APP_HOME%\lib\apkanalyzer-cli.jar;%APP_HOME%\lib\gson-2.3.jar;%APP_HOME%\lib\httpcore-4.2.5.jar;%APP_HOME%\lib\dexlib2-2.2.1.jar;%APP_HOME%\lib\commons-compress-1.12.jar;%APP_HOME%\lib\generator.jar;%APP_HOME%\lib\error_prone_annotations-2.0.18.jar;%APP_HOME%\lib\commons-codec-1.6.jar;%APP_HOME%\lib\kxml2-2.3.0.jar;%APP_HOME%\lib\httpmime-4.1.jar;%APP_HOME%\lib\annotations-12.0.jar;%APP_HOME%\lib\bcpkix-jdk15on-1.56.jar;%APP_HOME%\lib\jsr305-3.0.0.jar;%APP_HOME%\lib\explainer.jar;%APP_HOME%\lib\builder-model-3.0.0-dev.jar;%APP_HOME%\lib\baksmali-2.2.1.jar;%APP_HOME%\lib\j2objc-annotations-1.1.jar;%APP_HOME%\lib\layoutlib-api-26.0.0-dev.jar;%APP_HOME%\lib\jcommander-1.64.jar;%APP_HOME%\lib\commons-logging-1.1.1.jar;%APP_HOME%\lib\annotations-26.0.0-dev.jar;%APP_HOME%\lib\builder-test-api-3.0.0-dev.jar;%APP_HOME%\lib\animal-sniffer-annotations-1.14.jar;%APP_HOME%\lib\bcprov-jdk15on-1.56.jar;%APP_HOME%\lib\httpclient-4.2.6.jar;%APP_HOME%\lib\common-26.0.0-dev.jar;%APP_HOME%\lib\jopt-simple-4.9.jar;%APP_HOME%\lib\sdklib-26.0.0-dev.jar;%APP_HOME%\lib\apkanalyzer.jar;%APP_HOME%\lib\shared.jar;%APP_HOME%\lib\binary-resources.jar;%APP_HOME%\lib\guava-22.0.jar
SET APP_ARGS=%*
::Collect all arguments for the java command, following the shell quoting and substitution rules
SET APKANALYZER_OPTS=%DEFAULT_JVM_OPTS% -classpath %CLASSPATH% com.android.tools.apk.analyzer.ApkAnalyzerCli %APP_ARGS%
::Determine the Java command to use to start the JVM.
SET JAVACMD="java"
where %JAVACMD% >nul 2>nul
if %errorlevel%==1 (
echo ERROR: 'java' command could be found in your PATH.
echo Please set the 'java' variable in your environment to match the
echo location of your Java installation.
echo.
exit /b 0
)
:: execute apkanalyzer
%JAVACMD% %APKANALYZER_OPTS%
While checking the output of appium-doctor command - The following error was seen -
android, apkanalyzer could NOT be found in /Users/{user_name}/Library/Android/sdk!
The solution was to enable Android SDK Command-line tools from Android Studio Preferences
Checkout the screenshot
Hope this helps
APK Analyzer tool is available in android studio https://developer.android.com/studio/build/apk-analyzer.html.
Most the command executable options can be used just with the good UI available in the Android Studio.
The apkanalyzer file (with no extension) in my sdk>tools>bin installed on my windows 10 pc is a Unix Shell script.
Windows doesn't recognize this file as a valid command.
This appears to be a bug in the windows install of the Android SDK Tools 26.1.1.
This means that apkanalyzer does not exist in your SDK path.
To download it, just got to SDK Manager and click on Android SDK Tools, then click Ok to continue and download the missing tools.
SDK manager
As others have mentioned, make sure you have installed the Android SDK Tools via the SDK Manager. They should show up in <your_sdk_root>/tools/bin. A long time ago I added <your_sdk_root>/tools to my $PATH in my ~/.bash_profile, but never added <your_sdk_root>/tools/bin; apparently I missed the note that as of SDK Tools, Revision 25.3.0 tools were deprecated or otherwise moved to there among other places.
Seee also
https://developer.android.com/studio/command-line/ for details on the regular Tools, Build, Platform, and Emulator tools.
In Android Studio > Tools > sdkmanager > install Android SDK Command line tools
This worked for me!
I've submitted a bug report to Google: https://issuetracker.google.com/issues/124064881
Apparently it's broken on Windows.
be sure that Android Studio "Commandline Tools" installed on your system.
Then, add the following information into your system path;
C:\Users\user\AppData\Local\Android\Sdk\tools
C:\Users\user\AppData\Local\Android\Sdk\tools\bin
C:\Users\user\AppData\Local\Android\Sdk\cmdline-tools\latest
C:\Users\user\AppData\Local\Android\Sdk\cmdline-tools\latest\bin
It worked for me..
M. Yaşar Özden

Is there a way to tell WebStorm EAP where to find android_home?

Anyone managed to solve the issue with ANDROID_HOME variable with WebStorm EAP?
I have set up the variable at my machine level, and did it at WebStorm level but does not work:
ERROR running one or more of the platforms: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
You may not have the required environment or OS to run this project
Any idea?
I was facing the same problem in Ubuntu 15.10. It worked nicely when I compiled the program from terminal, but not when I tried the same command from WebStorm IDE.
The solution was trivial, yet hard to find. If you start the program from the launcher (or desktop file), the environmental variables are not getting populated the same way as from the .bashrc file. That is why there was no ANDROID_HOME at all, and the PATH was also different.
The accepted answer from this thread solved my problem: My .bashrc alias not run in .desktop file
Solution for Linux:
Find the WebStorm IDE desktop file (Mine was located at ~/.local/share/applications/jetbrains-webstorm.desktop)
Edit the Exec command (Add bash -ic before the executable file: Exec=bash -ic "/path/to/webstorm/bin/webstorm.sh" %f)
If you know the path to your android sdk home from your root then what you need to do is as a root user edit the /etc/profile and add this line at the end
export ANDROID_HOME="path/to/my/sdk"
To edit the /etc/profile file you can use nano,
sudo nano /etc/profile
add the export line at the end of the file, then press ctrl+o on your keyboard to save and ctrl+x on your keyboard to close.
Then restart your computer, you have successfully added the ANDROID_HOME env variable to your OS
In Linux, one should mind the difference between a login and an interactive shell environments. The former is visible to any application in a session, the latter - only to a shell (and processes launched from that shell). The correct solution is moving your variables into a login environment (~/.profile, ~/.bash_profile etc.) and restarting a session.
Under macOS, all JetBrains IDEs explicitly load a shell environment. If some variable isn't visible to some IDE component, then it's a bug either in that component or in a code which loads the environment; both cases better be reported to http://youtrack.jetbrains.com.

android' is not recognized as an internal or external command

I'm trying to get the new GCM service to work for me, so I've been following the demo as described here: http://developer.android.com/guide/google/gcm/demo.html
So far, everything works well. However, I'm supposed to build the ant files using the command line now, and that's where things stop working.
For some reason, this command $ android update project --name GCMDemo -p . --target android-16 gives me a very nice
'android' is not recognized as an internal or external command,
operable program or batch file.
Normally this can be fixed easily with a quick Google search, but I haven't found a single other user with this problem. Could someone tell me what the problem is?
My educated guess is that I need to add the Android tools folder to my PATH, but I'd rather be sure first.
Your guess is correct, just add the folder containing android.bat(tools folder) to the PATH. Otherwise the system will not be able to find the program.
Other possibility is change directory (using cd) to the tools folder, and execute the command from there. Since the current directory (whatever it is) is usually in the PATH, the system will find it. But this is not handy, because you frequently want to execute this command being in a different directory.
Find android.bat on your system. On mine (win 8 x64) it's under C:\Users\{username}\AppData\Local\Android\sdk\tools\android.bat
Open a command console, and use the 'doskey' command:
doskey android=C:\Users\{username}\AppData\Local\Android\sdk\tools\android.bat $*
This will continue to work in the open command console. To make it permanent is more difficult: http://darkforge.blogspot.com/2010/08/permanent-windows-command-line-aliases.html
You can also try adding it to your PATH as another poster suggested, but that didn't work for me. I recommend an easy gui for doing it, such as https://patheditor2.codeplex.com/
In Windows 7, navigate to
Control Panel\System and Security\System > advance system settings > environment variables
and update the path to include the following:
<android-root>\android-sdk-windows\tools
Use semicolons to separate paths if more than one exist.
On Windows 10, add both:
C:\Users\Parag Jain\AppData\Local\Android\sdk\tools
C:\Users\Parag Jain\AppData\Local\Android\sdk\build-tools
to the PATH environment variable of System and User. Make sure that you close your command prompt and restart a new prompt and then try the command.
Compiling previous answers I did the following to get Android SDK and gradle working (You need gradle working anyway to compile your Android project):
Prerequisites. You have Java jdk, Android SDK and gradle installed in the folders like I found on my computer. Please, check it:
C:\Program Files\Java\jdk1.X.X_XX\
C:\Users{username}\AppData\Local\Android\sdk\
C:\Program Files\Android\Android Studio\gradle\gradle-X.X\
Set up three new system variable (Control Panel\System and Security\System Advance system ->settings->environment variables-system variables). Do not forget to change java and gradle versions.
JAVA_HOME C:\Program Files\Java\jdk1.X.X_XX
ANDROID_HOME C:\Users\{username}\AppData\Local\Android\sdk
GRADLE_HOME C:\Program Files\Android\Android Studio\gradle\gradle-X.X\
Add the following paths to system paths (Control Panel\System and Security\System Advance system ->settings->environment variables-system variables):
%JAVA_HOME%
%ANDROID_HOME%\tools\
%ANDROID_HOME%\platform-tools
%GRADLE_HOME%\bin
Close and open once again your Dos application (Cmd terminal, etc.). You might want to REBOOT your computer, to make sure, that the system sees the variables. If you do not want to reboot, you can use the advice of #wordsforthewise
doskey android=C:\Users\{username}\AppData\Local\Android\sdk\tools\android.bat $*
Check if Android SDK and gradle work properly with the terminal commands
$ java -version
$ android list target
$ gradle -v
What worked for me:
Setting up the ANDROID_HOME variable as a System variable instead of a user variable.
I am using Windows 10, not sure if that matters.
I resolved this issue permanently using the below steps.
OS version : windows 7 64 bit
Solution : Set environment variable for android sdk and gradle
Step 1: Create new "ANDROID_HOME" User Variable
Variable Name: ANDROID_HOME
Variable Value C:\Users{user_name}\AppData\Local\Android\sdk\
Step 2: Create new "GRADLE_HOME" User Variable
Variable Name: GRADLE_HOME
Variable Value C:\Program Files\Android\Android Studio\gradle\gradle-x.x\
*Do not forget to change and gradle versions.
Step 3: Create "ANDROID_HOME" System Variable
Variable Name: ANDROID_HOME
Variable Value C:\Users{user_name}\AppData\Local\Android\sdk\
Step 4: Create new "GRADLE_HOME" System Variable
Variable Name: GRADLE_HOME
Variable Value C:\Program Files\Android\Android Studio\gradle\gradle-x.x\
*Do not forget to change and gradle versions.
Reopen the command prompt and confirm below command output :
1. gradle -v
2. android list target

What environment variable to set for "android update project -p ..."

I'm trying to set up ANT for my Android project. According to the Android website, the command to use is
android update project -p name
Unfortunately, the command "android" is not available on my command line (Windows 7).
Can you please tell me what kind of environment variables do I have to set up? The SDK is located in C:\Program Files (x86)\Android\android-sdk, I assume I will need that.
Do I just have to extend "path" or is there the need to create new variables (something like "JAVA_HOME", but for android).
Thank you
C:\Program Files (x86)\Android\android-sdk\tools
C:\Program Files (x86)\Android\android-sdk\platform-tools
are both valuable to have on the path. I don't remember which has the android binary, but, with both, you will definitely get it. With both you will also get adb and progaurd.
And also, extend PATH don't create a new one.

Unable to access jarfile lib\archquery.jar

Problem:
Unable to open SDK Manager (Flashes only for a second)
No build path target in Eclipse
Paths:
Android SDK: C:\Program Files\Android\android-sdk
JDK used for android: C:\Program Files\Java\jdk1.7.0_04 (There are other JDKs also in dir Java)
Environment Variables:
ANDROID_SDK_HOME: C:\Program Files\Android\android-sdk
JAVA_HOME: C:\Program Files\Java\jdk1.7.0_04;C:\Program Files (x86)\Java\jre1.6.0;C:\Program Files\Java\jre7;
System Path: C:\Program Files\Java\jdk1.7.0_04\bin;C:\Program Files\Java\jdk1.7.0_01\bin;C:\Program Files (x86)\Java\jdk1.5.0\bin;C:\Program Files\Android\android-sdk\tools\
Errors:
SDK Manager on cmd
Failed to execute tools\android.bat.
The system cannot find the file specified
Android.bat on cmd
Unable to access jar file lib\archquery.jar
Invalid path
find_java on cmd
nothing returned
I had a similar issue - I had to edit the android.bat ( and traceview.bat when I needed it)
in android.bat look for
for /f %%a in ('%java_exe% -jar %frameworkdir%archquery.jar') do set swt_path=%frameworkdir%%%a
replace with
set swt_path=lib\x86
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).
On Windows 7, at least, a batch 'FOR' loop, when executing a command for the list, does not use the current working directory, but the root. In this case, the command is '%java_exe% -jar lib\archquery.jar'. However, it's effectively being run from the root, e.g. 'C:\'. You can see this for your self with this simple test from the command line:
for /f %a in ('CD') do echo %a
So the command to run archquery is looking for the jar relative to the root directory, not your ADT directory, and thus can't be found.
I had similar issue and this is how it is solved.
Open android.bat file from \android-sdk-windows\tools in an editor.
Find the line
for /f "delims=" %%a in ('"%java_exe%" -jar lib\archquery.jar') do set swt_path=lib\%%a
and add rem in front of this line.
In the next line add set swt_path=lib\x86 (if you are using a 32-bit system) or set swt_path=lib\x86_64 (if you are using a 64-bit system).
Save the file. Close the cmd if you have one open. Navigate to android-sdk-windows\tools\ and run android. This should open SDK manager. But be sure to have JAVA_HOME defined in your environment variables and should point to JDK home.
This change to android.bat (below) fixed the problem for me. I can launch the SDK manager from Eclipse now too.
for /f "delims=" %%a in ('"%java_exe%" -jar %~dp0\lib\archquery.jar') do set swt_path=lib\%%a
See What does %~dp0 mean, and how does it work?
I fixed that by replacing:
for /f "delims=" %%a in ('"%java_exe%" -jar lib\archquery.jar') do set swt_path=lib\%%a
with
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 that i used " for the swt_path variable.
Hope that could help someone else.
Adding an environmental variable called "ANDROID_SWT" pointing to the directory that holds swt.jar got this to work for me. Seems like a better option then modifying the script.

Categories

Resources