I installed the Android SDK but I cannot use it because the AVD and SDK Managers do not run. When I try to open either one of them, a command prompt window pops up for about
I found the same problem that Rajesh found from his comment above. The command in parentheses on this line was not executing
for /f "delims=" %%a in ('"%java_exe%" -jar lib\archquery.jar') do set swt_path=lib\%%a
Edit: some people may have this line: for /f "delims=" %%a in ('"%~dps0find_java%arch_ext%.exe" -s') do set java_exe=%%a
This line is from find_java.bat
in the tools\lib\
directory of the sdk.
I have a Win 7 x64 system and I'm not about to reload the entire OS so I hardcoded what MZB suggested from his post above:
After this line:
for /f "delims=" %%a in ('"%java_exe%" -jar lib\archquery.jar') do set swt_path=lib\%%a
edit: or this line:
for /f "delims=" %%a in ('"%~dps0find_java%arch_ext%.exe" -s') do set java_exe=%%a
I added this line:
set java_exe=%JAVA_HOME%\bin\java.exe
This assumes you have the JAVA_HOME environment variable set to the Java JDK folder (without \bin
)
If your JAVA_HOME variable includes the \bin
then set it like this:
set java_exe=%JAVA_HOME%\java.exe
If you don't have the JAVA_HOME environment set, then you need to hard code it with the actual path you have on your machine as MZB did in his post.
I also did it for the javaw logic too:
set javaw_exe=%JAVA_HOME%\bin\javaw.exe
I can finally access the SDK Manager.
UPDATE 06/01/2015:
To Ken Y-N who updated this post after I submitted it:
When I created this post, I had referenced this line:
for /f "delims=" %%a in ('"%~dps0find_java%arch_ext%.exe" -s') do set java_exe=%%a
This in in my current find_java.bat from folder ...\sdk\tools\lib which I just updated yesterday from the current version of Android Studio Windows x64 version (android-studio-bundle-141.1903250-windows.exe). the variable %arch_ext% will either have 32 or 64 in it depending on what system they have.
But I don't know how the above line got converted to:
for /f "delims=" %%a in ('"%java_exe%" -jar lib\archquery.jar') do set swt_path=lib\%%a
after Ken Y-N did the edit.
But perhaps some people have your version in their find_java.bat file but I would believe some people have the other like I do. I'm just pointing this out for those that are having a problem not being able to open their SDK Manager.
Plus I should mention I had this problem with both JDK1.7 and JDK1.8. I had originally installed JDK1.8 but when reading the requirements for Android Studio yesterday, it said JDK1.7 was required, so I installed JDK1.7 last night thinking that would solve my problem, but the problem with find_java.bat was the same with either version of JDK.
I should point out too, when I installed Android Studio with both versions of the JDK, I was originally able to access the SDK Manager before opening up Android Studio for the first time. But when I opened up Android Studio, it started updating the SDK Manager first and maybe that's when the problem occurs because after starting up an IDEA project, I could not open up the SDK Manager after that.
So maybe find_java.bat has this line BEFORE opening up Android Studio for the first time:
for /f "delims=" %%a in ('"%java_exe%" -jar lib\archquery.jar') do set swt_path=lib\%%a
And when Adroid Studio updates the SDK, it the has this line?
for /f "delims=" %%a in ('"%~dps0find_java%arch_ext%.exe" -s') do set java_exe=%%a
I don't have time to test that out - I already lost so much time trying to figure out how to access the SDK. Maybe someone else can confirm this if they're having the same problem.