I realized I was confusing a lot of things; forget basically everything else, and I'm pretty sure this problem isn't even worth pursuing, since literally the only thing it affects is the ability to launch the SDK or AVD using the executables.
The problem is that the executables 'SDK Manager.exe' and 'AVD Manager.exe' located in D:\android-sdk\ don't work right. I believe all they do (or need to do) is run the command 'tools\android.bat' with either 'sdk' or 'avd' as the parameter. Running those commands myself in that folder works fine, the apps launch. But hitting the executables does the DOS flash, with no error output.
The problem with providing the batch files is that launching android.bat (after hardcoding the path to that jar) does work
. I'm pretty sure it's something to do with the executables, which would make sense that it's to do with Path. However, I have D:\android-sdk\ in path.Android.bat (Click to show)
rem don't modify the caller's environment
rem Set up prog to be the path of this script, including following symlinks,
rem and set up progdir to be the fully-qualified pathname of its directory.
rem Grab current directory before we change it
rem Change current directory and drive to where the script is, to avoid
rem issues with directories containing whitespaces.
cd /d %~dp0
rem Check we have a valid Java.exe in the path.
if not defined java_exe goto :EOF
rem Set SWT.Jar path based on current architecture (x86 or x86_64)
for /f %%a in ('%java_exe% -jar D:\android-sdk\tools\lib\archquery.jar') do set swt_path=lib\%%a
rem Copy android.bat and its required libs to a temp dir.
rem This avoids locking the tool dir in case the user is trying to update it.
xcopy %swt_path% %tmp_dir%\%swt_path% /I /E /C /G /R /Y /Q > nul
copy /B /D /Y lib\androidprefs.jar %tmp_dir%\lib\ > nul
copy /B /D /Y lib\org.eclipse.* %tmp_dir%\lib\ > nul
copy /B /D /Y lib\sdk* %tmp_dir%\lib\ > nul
copy /B /D /Y lib\common.jar %tmp_dir%\lib\ > nul
copy /B /D /Y lib\commons-compress* %tmp_dir%\lib\ > nul
copy /B /D /Y lib\swtmenubar.jar %tmp_dir%\lib\ > nul
copy /B /D /Y lib\commons-logging* %tmp_dir%\lib\ > nul
copy /B /D /Y lib\commons-codec* %tmp_dir%\lib\ > nul
copy /B /D /Y lib\httpclient* %tmp_dir%\lib\ > nul
copy /B /D /Y lib\httpcore* %tmp_dir%\lib\ > nul
copy /B /D /Y lib\httpmime* %tmp_dir%\lib\ > nul
rem jar_path and swt_path are relative to PWD so we don't need to adjust them, just change dirs.
cd /d %tmp_dir%
rem The global ANDROID_SWT always override the SWT.Jar path
if defined ANDROID_SWT set swt_path=%ANDROID_SWT%
if exist %swt_path% goto SetPath
echo ERROR: SWT folder '%swt_path%' does not exist.
echo Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
rem Finally exec the java program and end here.
REM set REMOTE_DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
call %java_exe% %REMOTE_DEBUG% -Dcom.android.sdkmanager.toolsdir="%tools_dir%" -Dcom.android.sdkmanager.workdir=%work_dir% -classpath "%jar_path%;%swt_path%\swt.jar" com.android.sdkmanager.Main %*
The only difference I made to this was to hardcode the path to archquery.jar. The line previously read '... -jar lib\archquery.jar'.
Originally Posted by Plan9
oh, and you've not added cd etc
like I've recommended
'cd /d %~dp0' is called earlier in android.bat to set the directory.