8

I can't fix the issue at hand and my head is continually becoming balder or balder.

The issue at hand is that my SDK manager won't find my Java, nor my SWT file.

I'm running Windows 7 64-bit and my SDK, Java, SWT are located as the following.

Java JDK  -  C:\Program Files\Java\jdk1.6.0_24
Java location  -  C:\Program Files\Java\jdk1.6.0_24\jre\bin
SDK manager -  C:\android-sdk-windows

I'm learning coding for the very first time, i've tried everything so far. Set the correct paths that the SDK manager specifies, even tried setting multiple ones, changing the batch files, and the list goes on.

Any ideas?

Chaotic android


Alright so removed the installer, set the paths, this is what i get

C:\Users\MuniFC Portable11>C:\android-sdk-windows\tools\android.bat
[INFO] Starting Android SDK and AVD Manager
'xcopy' is not recognized as an internal or external command,
operable program or batch file.
No command line parameters provided, launching UI.
See 'android --help' for operations from the command line.
java.lang.NullPointerException
    at com.android.sdklib.internal.avd.AvdManager.parseAvdInfo(AvdManager.java:1205)
    at com.android.sdklib.internal.avd.AvdManager.buildAvdList(AvdManager.java:1184)
    at com.android.sdklib.internal.avd.AvdManager.<init>(AvdManager.java:385)
    at com.android.sdkuilib.internal.repository.UpdaterData.initSdk(UpdaterData.java:238)
    at com.android.sdkuilib.internal.repository.UpdaterData.<init>(UpdaterData.java:114)
    at com.android.sdkuilib.internal.repository.UpdaterWindowImpl.<init>(UpdaterWindowImpl.java:86)
    at com.android.sdkuilib.repository.UpdaterWindow.<init>(UpdaterWindow.java:42)
    at com.android.sdkmanager.Main.showMainWindow(Main.java:302)
    at com.android.sdkmanager.Main.doAction(Main.java:281)
    at com.android.sdkmanager.Main.run(Main.java:99)
    at com.android.sdkmanager.Main.main(Main.java:88)

Set at the right environmentals and got this

C:\Users\MuniFC Portable11>C:\android-sdk-windows\tools\android.bat
[INFO] Starting Android SDK and AVD Manager
'xcopy' is not recognized as an internal or external command, operable program or batch file.
No command line parameters provided, launching UI.
See 'android --help' for operations from the command line.
java.lang.NullPointerException
    at com.android.sdklib.internal.avd.AvdManager.parseAvdInfo(AvdManager.java:1205)
    at com.android.sdklib.internal.avd.AvdManager.buildAvdList(AvdManager.java:1184)
    at com.android.sdklib.internal.avd.AvdManager.<init>(AvdManager.java:385)
    at com.android.sdkuilib.internal.repository.UpdaterData.initSdk(UpdaterData.java:238)
    at com.android.sdkuilib.internal.repository.UpdaterData.<init>(UpdaterData.java:114)
    at com.android.sdkuilib.internal.repository.UpdaterWindowImpl.<init>(UpdaterWindowImpl.java:86)
    at com.android.sdkuilib.repository.UpdaterWindow.<init>(UpdaterWindow.java:42)
    at com.android.sdkmanager.Main.showMainWindow(Main.java:302)
    at com.android.sdkmanager.Main.doAction(Main.java:281)
    at com.android.sdkmanager.Main.run(Main.java:99)
    at com.android.sdkmanager.Main.main(Main.java:88)`

My android.bat file is as so

`@echo off
rem Copyright (C) 2007 The Android Open Source Project
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem      http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

rem Useful links:
rem Command-line reference:
rem   http://technet.microsoft.com/en-us/library/bb490890.aspx

rem don't modify the caller's environment
setlocal

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.
set prog=%~f0

rem Grab current directory before we change it
set work_dir="%cd%"

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.
set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF

set jar_path=lib\sdkmanager.jar

rem Set SWT.Jar path based on current architecture (x86 or x86_64)
for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a

if "%1 %2"=="update sdk" goto StartUi
if not "%1"=="" goto EndTempCopy
:StartUi
    echo [INFO] Starting Android SDK and AVD Manager

    rem We're now going to create a temp dir to hold all the Jar files needed
    rem to run the android tool, copy them in the temp dir and finally execute
    rem from that path. We do this only when the launcher is run without
    rem arguments, to display the SDK Updater UI. This allows the updater to
    rem update the tools directory where the updater itself is located.

    set tmp_dir=%TEMP%\temp-android-tool
    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

    rem jar_path and swt_path are relative to PWD so we don't need to adjust them, just change dirs.
    set tools_dir=%cd%
    cd /d %tmp_dir%

:EndTempCopy

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.
    goto :EOF

:SetPath
rem Finally exec the java program and end here.
call %java_exe% -Dcom.android.sdkmanager.toolsdir="%tools_dir%" -Dcom.android.sdkmanager.workdir=%work_dir% -classpath "%jar_path%;%swt_path%\swt.jar" com.android.sdkmanager.Main %*

rem EOF`

the variables are as so

ANDROID_SWT = ;C:\android-sdk-windows\tools\lib\x86_64
peterh
  • 11,875
  • 18
  • 85
  • 108
Chaoticandroid
  • 219
  • 2
  • 4
  • 13
  • Also See [Some similiar posts](http://stackoverflow.com/questions/5137243/some-sdk-installation-problems/5410383#5410383) – Alpine Mar 23 '11 at 19:31

6 Answers6

4

In case any of you still couldn't find solution. Do this. It worked for me. In your android SDK chagne tools/android.bat and tools/lib/find_java.bat as

(find_java.bat)

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

set java_exe=C:\PROGRA~1\Java\JDK17~1.0_4\bin\java.exe and

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

set javaw_exe=C:\PROGRA~1\Java\JDK17~1.0_4\bin\javaw.exe

(android.bat)

for /f "delims=" %%a in ('"%java_exe%" -jar archquery.jar') do set swt_path=lib\%%a into

set swt_path=lib\x86 (my system is 32 bit so i put x86 if your system is 64 then you should put \x86_64)

hope it will work for you too.

Dimpu Aravind Buddha
  • 9,505
  • 4
  • 17
  • 23
3

I Had the same problem, what happened in my machine is that somehow the xcopy was not beeing recognized. I solved the issue adding the xcopy path in the PATH enviroment variable. In my machine the xcopy.exe is located in windows\system32 folder, resulting in this (i have sdk 8, change to whatever you using):

PATH = C:\Program Files\Java\jdk1.8.0\bin;%SystemRoot%\system32

Rodrigo López
  • 4,039
  • 1
  • 19
  • 26
3

Maybe this help? I removed the .android folder under C:\Users\\ and it works. Android installation/SDK Manager issues

Community
  • 1
  • 1
gWay
  • 1,087
  • 9
  • 7
2

You are using the private JRE for JDK as your Java location suggest

Java location  -  C:\Program Files\Java\jdk1.6.0_24\jre\bin

If you had installed a public JRE (which is available to all Java Applications and not limited to JDK) your Java Location would be something like this

C:\Program Files\Java\jre1.6.0_24\bin

But Android SDK manager can works with private JRE.

Try setting the PATH environment variable for Java.

Refer
How do I set or change the PATH system variable? or
How to Add, Remove or Edit Environment variables in Windows 7?

After you have set the PATH variable start SDK Manager.exe

It should work now.


Edit

You are setting the PATH wrong

Java JDK  -  C:\Program Files\Java\jdk1.6.0_24
Java location  -  C:\Program Files\Java\jdk1.6.0_24\jre\bin

remove the above PATH and set the PATH as

C:\Program Files\Java\jdk1.6.0_24\bin

This should work. It works for me on jdk1.6.0_20


Edit

Did you read

Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 64-bit SWT libraries on 32-bit JVM

Install a 64-bit JDK for a 64-bit JVM and set the PATH accordingly.


The question is now getting longer.
Let this question address SDK manager does not find Java and post another question with reference to this question and the other specific error you get.

Alpine
  • 3,838
  • 1
  • 25
  • 18
  • How do i set a public JRE? and my path is set to the exact location of the java.exe in the sdk and i've even tried it for the standard jre – Chaoticandroid Mar 23 '11 at 16:21
  • 1
    While installing JDK if you select custom setup it asks whether you want to install a public JRE or private JRE. – Alpine Mar 23 '11 at 16:23
  • If you want to install a public JRE then downloading a JRE from [Oracle](http://www.oracle.com/technetwork/java/javase/downloads/index.html) and installing it separately will also work. – Alpine Mar 23 '11 at 16:25
  • the custom setup is the default page that opens and i didn't see any check for a public jre nor anything relative to it – Chaoticandroid Mar 23 '11 at 16:33
  • no dice, maybe it's just that the SDK doesn't work with anything 64 bit – Chaoticandroid Mar 23 '11 at 16:38
  • i had the 32 bit saved in my folders, it has the public JRE in the inital install, i'll try to run it via the 32 bit one...hopefully that will work – Chaoticandroid Mar 23 '11 at 16:41
  • I have updated my answer. Set the path as `C:\Program Files\Java\jdk1.6.0_24\bin` and not as `C:\Program Files\Java\jdk1.6.0_24` or `C:\Program Files\Java\jdk1.6.0_24\jre\bin` – Alpine Mar 23 '11 at 16:42
  • Alright got the Java issue out of the way, now i ran it, got a CMD screen, went again, ran android.bat in command prompt and it said that the 'xcopy' is not a recognize int/ext command and that it can't run the 64 bit swt – Chaoticandroid Mar 23 '11 at 16:48
  • Did `SDK Manager.exe` start and you get the `Android SDK and AVD Manager` screen? A blank cmd screen will be active at the back at the same time. – Alpine Mar 23 '11 at 16:52
  • negatory boss, the cmd came and went and i posted the error i got when i ran it via command prompt up top – Chaoticandroid Mar 23 '11 at 16:55
  • Are you loading Android SDK for first time? You will need platforms and emulators which are not included in the Started SDK. Try starting `SDK Manager.exe` – Alpine Mar 23 '11 at 16:59
  • You will need to update the SDK with a platform if your `platforms` folder is empty. – Alpine Mar 23 '11 at 17:00
  • executing the manager gives me a cmd screen that comes and goes and doesn't allow me to do anything beyond, can't download nada with the manager...which kinda defeats the purpose lol OPTIMISM! – Chaoticandroid Mar 23 '11 at 17:02
  • and how did you do that, put the error in the blue box...i was looking for it and couldnt figure it out lol – Chaoticandroid Mar 23 '11 at 17:03
  • Is your `platforms` folder empty? – Alpine Mar 23 '11 at 17:05
  • _how did you do that, put the error in the blue box._ Thats another question refer [How to colorize code in SO code block?](http://meta.stackexchange.com/q/84239/157949) – Alpine Mar 23 '11 at 17:07
  • yep dry as a bone, platforms and add-ons because i can't start the manager to download anything, i know that android.bat is pretty much android.exe because it relies on the bat file to get the right locations, but android.exe runs a CMD screen and then disseapers and that's the gist of it...no download screen nothing, no error, nada, and i've checked the developpers website time and time again, what i get isn;t what is shown lol – Chaoticandroid Mar 23 '11 at 17:08
  • thanks for the tip btw on the code box :P much appreciated 'Today i learned something!' =D – Chaoticandroid Mar 23 '11 at 17:09
  • How did you install SWT libraries? – Alpine Mar 23 '11 at 17:10
  • i've tried the manager.exe in the cmd prompt and got nil, as well as running it as admin, and got nil, a black cmd screen that comes and goes...this is really annoying – Chaoticandroid Mar 23 '11 at 17:12
  • C:\android-sdk\tools\lib\x86 - came with the installer (the latest one) – Chaoticandroid Mar 23 '11 at 17:12
  • Oh! I also have those libraries! never saw those files! – Alpine Mar 23 '11 at 17:14
  • hehe, well in any case, that's the swt file and it just doesn't want to find it and i set my swt_path and android_swt in the environment and got nil. – Chaoticandroid Mar 23 '11 at 17:16
  • Is your Android SDK 64-bit? I have updated the answer for `Cannot load 64-bit SWT libraries on 32-bit JVM` Use a 64-bit JDK – Alpine Mar 23 '11 at 17:16
  • i got the sdk working by installing the 32bit SDK cause the 64 bit one didn't work, but the 64 bit one is still there none the less and that was during our converstation. – Chaoticandroid Mar 23 '11 at 17:18
  • Remove the 32 bit JDK from the `PATH` and add the 64-bit JDK to the `PATH` the `PATH` will be `C:\Program Files\Java\jdk1.6.0_24\bin` not `C:\Program Files\Java\jdk1.6.0_24` The `\bin` is important – Alpine Mar 23 '11 at 17:21
  • I had set my paths earlyer to my 64bit SDK and they we're as set above and the manager, android.bat and find_java.bat couldn't locate it, so i re-installed the 32 bit, changed the same extensions but with (x86) and the java error disseapeared but gave me that one – Chaoticandroid Mar 23 '11 at 17:21
  • do i need to add ; at the front? – Chaoticandroid Mar 23 '11 at 17:21
  • Yes if there are other directory path before the one you are adding (and most likely there will be) – Alpine Mar 23 '11 at 17:24
  • Also note don't forget the `\bin` Earlier you set it as `Java JDK - C:\Program Files\Java\jdk1.6.0_24` as mentioned in your question. – Alpine Mar 23 '11 at 17:26
  • yep, set the \bin, changed the path to my 64 bit, error remains the same. – Chaoticandroid Mar 23 '11 at 17:28
  • yep, all paths are set to 64 bit...no change, could it be something within the bat file itself, a bad location? – Chaoticandroid Mar 23 '11 at 17:32
  • did you modified it? `android.bat` My file is at location `android-sdk-windows\tools\android.bat` – Alpine Mar 23 '11 at 17:33
  • C:\android-sdk-windows\tools\android.bat for the zip and C:\android-sdk-windows\tools\android.bat for the exe (installed the exe to see if that would be easier, turns out to be the same BS) – Chaoticandroid Mar 23 '11 at 17:36
  • so let's see, all my paths are set to 64-bit, that solved the java issue, the files are all where they should be, and the error when i run android.bat is as follows up top still and i dont understand why...could the android.exe be 32 bit? – Chaoticandroid Mar 23 '11 at 17:41
  • Instead of using command prompt try starting it from `SDK Manager.exe` by double clicking the icon. What happens? You now changed the `PATH` to 64-bit JDK – Alpine Mar 23 '11 at 17:41
  • cmd comes and goes, this is getting frustrating lol, too bad the developpers site doesn't have a contact us page hehe – Chaoticandroid Mar 23 '11 at 17:44
  • It says `Cannot load 64-bit SWT libraries on 32-bit JVM` so the libraries must be 64-bit and the JDK(JVM) was 32-bit, so it should be solved. Also did you removed all reference to 32-bit JDK from `PATH`? and uninstalled the android-sdk which you installed from the installer? – Alpine Mar 23 '11 at 17:44
  • all 32 bit is removed from path yes, so i don't know how this error can occur but i did find this while going through the android.bat – Chaoticandroid Mar 23 '11 at 17:47
  • uninstalled the android-sdk which you installed from the installer? – Alpine Mar 23 '11 at 17:50
  • ok so i removed the installer but i still get this error when i open the android.bat 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. goto :EOF – Chaoticandroid Mar 23 '11 at 17:53
  • alright the update via command prompt is up top, java is good, at the 64 doesnt work on 32 is dealt with – Chaoticandroid Mar 23 '11 at 17:58
  • Try adding `ANDROID_SWT=` to `PATH` – Alpine Mar 23 '11 at 17:58
  • in the edit of the android.bat or the environmental variables – Chaoticandroid Mar 23 '11 at 17:59
  • environment variable also is now everything in 64 bit or 32 bit? I think we are now trying to start in 64 bit right? – Alpine Mar 23 '11 at 18:00
  • yep everything is 64bit, and we're almost there! and my variables for the swt was already set to C:\android-sdk-windows\tools\lib\x86_64 but that didn't work so i thought of leaving like C:\android-sdk-windows\tools\lib but no dice – Chaoticandroid Mar 23 '11 at 18:02
  • `C:\android-sdk-windows\tools\lib` will never work because the file is not located there. – Alpine Mar 23 '11 at 18:04
  • try the `\x86_64` folder so the path will be `ANDROID_SWT=C:\android-sdk-windows\tools\lib\x86_64` – Alpine Mar 23 '11 at 18:05
  • Dont add this in `PATH` you have to create another environment variable named `ANDROID_SWT` There will be a `New` button use that – Alpine Mar 23 '11 at 18:06
  • set as above and no dice, still can't find the swt – Chaoticandroid Mar 23 '11 at 18:10
  • by any chanc do you know what the 'xcopy' thing stands for? – Chaoticandroid Mar 23 '11 at 18:12
  • During my installation I didn't needed to set the swt all went fine. – Alpine Mar 23 '11 at 18:12
  • try double clicking `SDK Manager.exe` – Alpine Mar 23 '11 at 18:13
  • did you in any way modified `android.bat`? – Alpine Mar 23 '11 at 18:15
  • nope same error as before i posted it uptop and ill add my full android.bat there, with my environemental locations – Chaoticandroid Mar 23 '11 at 18:27
  • try `ANDROID_SWT=C:\android-sdk-windows\tools\lib\x86` – Alpine Mar 23 '11 at 18:34
  • wait! why is `ANDROID_SWT = ;C:\android-sdk-windows\tools\lib\x86` there a `;`? – Alpine Mar 23 '11 at 18:34
  • `;` means end of path so path is not found. First try `ANDROID_SWT=C:\android-sdk-windows\tools\lib\x86_64` if it doesnt work try `ANDROID_SWT=C:\android-sdk-windows\tools\lib\x86` – Alpine Mar 23 '11 at 18:36
  • If you solved the problem please post the solution so others with similar problem might get help. – Alpine Mar 23 '11 at 19:04
  • nope, that didn't do anything, still can't find the swt thats really weird sorry for the long wait...ups stopped by – Chaoticandroid Mar 23 '11 at 19:12
  • Post another question with the error you are getting with a reference to this question and add the details of the error you are getting on that question. This question is getting too long for a title _SDK manager does not find Java_ – Alpine Mar 23 '11 at 19:16
  • did you try both `\x86` as well as `\x86_64` – Alpine Mar 23 '11 at 19:17
  • Yep tried both and i'll do that, i agree with you on the getting way too long part haha but at least you we're able to help me with the java problem hehe – Chaoticandroid Mar 23 '11 at 19:33
  • Your Welcome. By specifying in details the error you are getting in a new question and also mentioning what you did till now to solve the problem will help you get answers from more no of people. – Alpine Mar 23 '11 at 19:36
  • Try editing your [similar question](http://stackoverflow.com/questions/5377149/android-sdk-issue-does-not-find-java-swt-windows-7-x64) It will avoid you from people asking you not to post duplicate questions. – Alpine Mar 23 '11 at 19:38
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

It's not a path problem, you need to install jdk 32bits because android sdk is only 32bits.

ted
  • 9
  • 1