0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SDKManagerが起動しない

Posted at

ある日突然SDKManagerが起動しなくなってしまいました。
AndroidSDKのtools/android.batを起動すると↓のようになってしまう・・

tools>android.bat
-v / -version: Only prints the Java version found.
'-v' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
無効なパスの指定です
ERROR: SWT folder '' does not exist.
Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.

tools/lib/find_java.batでJavaのexeファイルの場所を探しているところでうまくいっていないよう。

for /f "delims=" %%a in ('"%~dps0\find_java%arch_ext%.exe" -s') do set java_exe=%%a

この時点でのjava_exeを確認すると、-v / -version: Only prints the Java version found.のようになっていて、これが最初のエラーになっているらしいです。

ヘルプを出力したときの最後の行が代入されている?

tools>lib\find_java32.exe -h
Outputs the path of the first Java.exe found on the local system.
Returns code 0 when found, 1 when not found.
Options:
-h / -help       : This help.
-t / -test       : Internal test.
-e / -error      : Print an error message to the console if Java.exe isn't found.
-j / -jdk        : Only returns java.exe found in a JDK.
-s / -short      : Print path in short DOS form.
-p / -path `dir` : A custom path to search first. Pass in JDK base dir if -j is set.
-w / -javaw      : Search a matching javaw.exe; defaults to java.exe if not found.
-m / -minv #     : Pass in a minimum version to use (default: 1.6).
-v / -version: Only prints the Java version found.

結局、こちらを参考にfind_java.batでJavaのexeファイルのパスを直接定義したら、動くようになりました。
(なぜ-v / -version: ...になってしまうかは結局よくわかりませんでした・・)

find_java.bat(抜粋)
rem Check we have a valid Java.exe in the path. The return code will
rem be 0 if the command worked or 1 if the exec failed (program not found).
for /f "delims=" %%a in ('"%~dps0\find_java%arch_ext%.exe" -s') do set java_exe=%%a
if not defined java_exe goto :CheckFailed

:SearchJavaW
rem Check if we can find a javaw.exe at the same location than java.exe.
rem If that doesn't work, just fall back on the java.exe we just found.
for /f "delims=" %%a in ('"%~dps0\find_java%arch_ext%.exe" -s -w') do set javaw_exe=%%a
if not exist "%javaw_exe%" set javaw_exe=%java_exe%

↓↓

find_java.bat(抜粋)
rem Check we have a valid Java.exe in the path. The return code will
rem be 0 if the command worked or 1 if the exec failed (program not found).
rem for /f "delims=" %%a in ('"%~dps0\find_java%arch_ext%.exe" -s') do set java_exe=%%a
set java_exe="C:\PROGRA~1\Java\JDK18~1.0_2\bin\java.exe"
if not defined java_exe goto :CheckFailed

:SearchJavaW
rem Check if we can find a javaw.exe at the same location than java.exe.
rem If that doesn't work, just fall back on the java.exe we just found.
rem for /f "delims=" %%a in ('"%~dps0\find_java%arch_ext%.exe" -s -w') do set javaw_exe=%%a
set javaw_exe="C:\PROGRA~1\Java\JDK18~1.0_2\bin\javaw.exe"
if not exist "%javaw_exe%" set javaw_exe=%java_exe%

※ 参考にしたサイト
android.batが正常に動作しない件について - BLOG_2012~(PC,Audio,etc・・・・)

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?