android.bat Opens SDK Manager, SDK Manager.exe does not - android

I've been trying to fix this for the last 48 hours, and it is driving me insane.
My SDK Manager.exe flashes a cmd screen and closes in less than a second.
After much searching, I finally managed to get my SDK Manager to open after adjusting android.bat, and running it as administrator.
But, SDK Manager.exe was not able to find android.bat so I copied it into the android-sdk folder.
SDK Manager.exe is now able to find android.bat, but it is still briefly flashing cmd and then closing.
My PATH variable has my jdk java.exe directory as the first entry, and I have restarted and reinstalled several times.
What is causing this? Why am I able to open the manager from android.bat, but not from the executable?
I am trying to configure Eclipse to use the SDK Manager, but obviously I cannot because the executable refuses to open.
Eclipse is also telling me that adb.exe is missing, and upon checking platforms I have confirmed this. I assume adb.exe will be installed from the SDK Manager?
Edit: After thinking about it, I think the issue may be with the permissions of android.bat. It must be run as administrator in order to work, otherwise if opened regularly it will say "Access is denied".
Is it possible to change this? Looking in the properties of android.bat, I have adjusted my account to have full control. This has not affected the issue, though.

I've experienced this on some machines, but not others. It's a strange problem and I believe it has to do with a path problem in one of the android files (android.bat?).
Why this happens on some installs and not others I have yet to figure out. I've read everything I could find both here and on the interweb, tried many different solutions, including installing another version of JDK 6 and 7, modifying the path variable, adding a JAVA_HOME variable, etc. and none worked.
This worked for me in Windows 7...
1) Add a copy of the "SDK Manager.exe" file INSIDE the SDK folder (so it's next to the tools, platforms, et. al folders) and then run it. You will still see the command window "flash" for a second and then disappear, but be patient and the SDK manager WILL show up.
2) Create a shortcut to this "inside" copy of the SDK Manager.exe and move it where ever you want; it now knows where to go to find the files and works every time. I have a copy on my desktop, but it doesn't matter where you put it.
Note: There's still a problem somewhere, and it may have to do with Google, but it seems to happen to some people regardless of what/when they do an install, while others have no issues at all.
This may not be the answer we need to get Google to fix it, but it works without uninstalling/reinstalling java or the SDK, modifying/adding variables, modifying android.bat, changing your path, running as admin, etc., and the best part is it's easy. It's too bad many of us have wasted hours of time on trying to fix it.
Good Luck!
Note: I added the comment below about x64 machines. It's strange, but when we tried it on one x64 (OS/ADT) machine and it didn't work. I just tried a fresh install of Java 7 x64, and ADT x64 on a machine where it was working with a 32bit install (meaning I now have both 32bit and 64bit installs of Java and ADT on the same machine) and again, it works fine. A brief flash, it goes away, and then the SDK manager opens as expected. The mystery continues. :)

I had the same problem when I updated my android SDK tools to 23.0.2. Spent a lot of time (around 6 hours) messing around trying to find a fix... and I found it, but still not sure how it all works.
It has to do with android.bat file in the tools folder of your android SDK directory, in the lines:
set java_exe=
call lib\find_java.bat
I modified the lines into the following values:
set java_exe=pathwhereyoufindjavaexe
REM call lib\find_java.bat
Basically, two things are done:
Set your java_exe variable to your Java.exe path
Delete, or comment the line: "call lib\find_java.bat"
I commented second line so it DOESN'T re-set my java_exe variable through find_java.bat, and manually set my java_exe variable to where my java.exe file is. If you don't know where (or forgot where) your java.exe is, try using windows search for it.
My path for java.exe is different from the one found using find_java.bat.
My Actual path:
U:\PortableApps\CommonFiles\Java\bin\Java.exe
The path find_java.bat sets it to:
C:\Windows\systems32\java.exe
NOTE:
I figured what path "call lib\find_java.bat" sets the java_exe variable through adding the following command below the line itself:
echo %java_exe%
pause
I'm not sure if this is some sort of permission or access error, or this solution worked only for me since my java JDK is on USB device or such. Well, if anyone else bump into this problem, give my solution a try and see if it works for you guys as well.

I had the same issue!
I had installed the ADT bundle 64-bit, so I downloaded Java 64-bit.
I messed around with paths and things, but the thing that fixed it in the end was installed Java 32-bit.
The easy fix is to install both versions. You can download them manually here.
Good luck!

I don't know if it will solve your problem but make sure you have installed jre and jdk and android sdk for the same bit system (I mean that all three are for 32 or 64 bit systems).
I once had an android problem based on this!
If you use them for one system try to reinstall them.
I had a similar problem and it worked after changing all versions to 64 bit.
Hope I could help you.

When you 'Run as administrator' the current directory gets changed because you are impersonating another user. To prove this put the following line at the top of your bat file:
echo.CD=%CD% & pause
Then execute your bat file as a normal user and observe result.
Now execute bat file via 'Run as administrator' and note that CD has been changed to C:\Windows\system32 (typical).
The fix is simple. Put the following line in your bat file to restore the current directory:
pushd %~dp0
It needs to be before you reference any files/folders. I typically put that line near the top of all bat files that may be 'Run as administrator'. It does not hurt anything if used for older (XP) OS's.

I had same problem with Windows 8.1 64-bit and JDK8. I uninstalled JDK8x64 and installed JDK8i586 and now it works like a charm.

Related

Android SDK wont open

I have tried a lot of the solutions to this problem I have seen here but none seem to work for me.
Basically when I run the Android batch file a CMD box pops up for a millisecond and closes again.
I can see that it says: "find_java.exe was unexpected at this time".
I have no idea why this is happening. I think it might be because I am not installing it onto the main hard drive that my OS is on, which is an SSD, but instead installing it onto a second drive.
So the file path to the JDK is:
F:\Program Files (x64)\Java\jdk1.7.0_11
Anybody know how I could fix this?
Thanks
I ran into the same problem. I found a way to fix it. Go to the System32 folder and change java to java.exe, hopefully this will work. Also make sure you have jdk and jre installed. That's all.
Assuming you are running windows make sure that you have a system variable named JAVA_HOME set to point to your Java home directory
JAVA_HOME = F:\Program Files (x64)\Java\jre6 (or whatever version your JRE is)
and add
F:\Program Files (x64)\Java\jdk1.7.0_11\bin to the PATH system variable
Notice the \bin added to the end there

Installing Android SDKr18, SDK will not detect the JDK

![enter image description here][1]Thanks for taking the time to read my question.
This is not another back, then next problem.
I have installed eclipse classic and jdk-7u3-windows-x64, the problem is when I go to install the android SDK, I get this error:
http://i.stack.imgur.com/V9VIY.jpg
I have been searching the net all night, one solution seems to be for an earlier version of the Android SDK is to click back then next, I have tried this to no avail.
I have also set up a environment variable, this didn't work either.
I have checked that java has definitely been installed, I have run and installed all software as admin. Still I get the same message.
So can anyone out there help me with this issue?
Big thanks in advance for any help!
Nick.
I had similar problem with Windows 7 - 64 bit machine. The installation of the Andriod SDk wil l hang on the screen where it is trying to locate JDK. I had both 64 and 32 bit JDK installed. JAVA_HOME was set to correct JDK (32) bit to C:\Java\jdk1.6.0_13 but the installer will get stuck in a loop and will never recover from the screen.
It is silly really but what I had to do was, to reinstall jdk-6 32 bit in a different directory this time (C:\Program Files (x86)\Java\jdk1.6.0_31) , change the JAVA_HOME to C:\Program Files (x86)\Java\jdk1.6.0_31 and reinstall SDK.
Very strangely it didn't pick up new installation of JDK at C:\Program Files (x86)\Java\jdk1.6.0_31 as set in the JAVA_HOME, instead it picked up my old installation from C:\Java\jdk1.6.0_13\
Someone really need to check their codes at Google!!
But sorted , I am happy
I think all the installed and uninstalling of java caused the above error. Anyway restored my computer back to a certain point and installed the jdk 6 32 instead to start with. The sdk found it straight away.

Android SDK installer doesn't see java

I recently updated to ADT r17. Ever since then, none of the android tools could see java on my system. I could not launch AVD Manager, SDK Manager, Draw-9patch, anything. The only way I could get an AVD to launch was to compile from eclipse without my phone plugged it. Java is still on my system, everything was working perfectly on r16. I can still go into the command line and type java and javac and everything works.
I uninstalled the sdk (by deleting the folder) and am attempting to reinstall it. The installer doesn't even see java. I tried clicking back and next again. No dice. I have in my system variables:
JAVA_HOME C:\Program Files\Java\jdk1.7.0_03\bin
I just did that one after the first failed attempt to reinstall since that's what is recommended on the installer. Did not help. What was working before was:
...F:\Development\Android\android-sdk\platform-tools;C:\Program Files\Java\jdk1.7.0_03\bin;...
I can confirm that at the end of the filepath, in the bin folder, java.exe and all it's other programs are there. I'm downloading the .zip sdk, but I don't think that's going to help much, since none of the tools seem to see java even when extracted. Edit: I can confirm, simply extracting the .zip did not help.
I'm on a 64bit system. Everything was working with r16. Any ideas? Should I go back to r16?
You can reference here: http://code.google.com/p/android/issues/detail?id=28196
I set JAVA_HOME=d:\jdk1.7\jre\ (which is my JDK's directory) to solve this problem.
For whatever reason, adt r17 decided it did not like 64bit Java, even though r16 was fine with it. Installed 32bit java and added that to my path. Everything is fine now.

Android "A folder failed to be renamed or moved" (fixes tried, no success)

Here is how my story goes. At first, I installed the Android SDK in the default directory it selected, which was Program File (x86) (which I thought the default was supposed to be app data?!) After SUCCESSFULLY pulling the APIs I quickly realized the mistake I had made, due to spaces being in the name, so I then uninstalled it and re-installed it in my D drive under a folder called development.
That all went fine, but when I tried to pull the SDK, I received the "A folder failed to be renamed or moved" message. I then tried disabling my anti-virus (more on that later), closing all other windows, and even ending windows explorer, but nothing changed.
To disable my antivirus, I used it's control panel (Avast BTW) to turn off the shields. What I really wanted to do was end the process, but, and here is the big but, Access Denied! I even ran taskmgr.exe as admin, but no success. Can anyone explain why that is? Anyways, after getting fed up with it all, I just booted into safemode with networking, and all is well for now, but I really would hate doing this every time I need to update the SDK, so any suggestions on how to fix this would be a great help, especially how to end my antivirus process so I can see if that's the problem.
EDIT: And I also did all that while running the Android SDK manager as administrator from the folder it is installed in.
I assume that the problem happens because the upgrade program wants to upgrade itself directly while it is running. My solution is that every time before you want to install something new, make a copy of \<sdk dir>\tools dir in the \<sdk dir>\ path, and then, upgrade or install something by excecuting android.bat in the copied tools folder. This works for me.
try rename "platform-tools" folder as "_platform-tools" and create a new folder as name "platform-tools".
that's work for me!
Having eclipse open sometimes causes this.
Open the Android SDK Manager then close eclipse before you press the "install packages" button and it should be fine.

Trouble getting Android emulator to run in eclipse

I'm trying to run the SDK Samples on the Emulator in Eclipse 3.5.
Most of the time the AVD Manager hangs when I try to create a new AVD.
When I manage to create an AVD and try to start the emulator I get this:
emulator: ERROR: no search paths found in this AVD's configuration
weird, the AVD's config.ini file is malformed. Try re-creating it.
I'm running the latest version of the SDK on Win7 32 bit. Any ideas?
Update:
I think I found the source of the problem. I'm running a Hebrew version of WIN 7. My user name is in Hebrew. Apparently this causes a problem for Eclipse. Once I started to suspect that was the problem, I created a new user on the system called DEV and tried to run the emulator under that user. Went like butter.
You can set the environment variable ANDROID_SDK_HOME. For example:
ANDROID_SDK_HOME=D:\Development\android-sdk\
It helped me. Add this variable to <eclipseFolder>\configuration\.settings\org.eclipse.ui.ide.prefs:
ANDROID_SDK_HOME=D\:\\Development\\android-sdk\\
Stop the process adb.exe and (re)start Eclipse.
The problem here is that my c:\users... path has foreign characters in it "Michael Schøler" - the "ø" being the problem.
This is an ecclipse and/or Android SDK problem.
move c:\Users\YourName\.android\avd\YourAVDName.avd manually to c:\Android\YourAVDName.avd then open c:\Users\YourName\.android\avd\YourAVDName.ini and change path from
path=c:\Users\YourName\.android\avd\YourAVDName.avd to path=c:\Android\YourAVDName.avd
Another rather simple solution to this problem (non-english characters in the AVD's path), is to use the "shortname" of the directories. In my case:
My windows user is "András", so my homedir is C:\Users\András
If you open up a cmd, cd to C:\Users, and issue a "dir /x" command, you will see the "shortnames" of the directories, in my case it is "ANDRS~1".
So you just change the path in the AVD's config file from C:\Users\András\blabla to C:\Users\ANDRS~1\blabla, and voila, it works.
If you have special character in your username do this:
~/.android/avd on OS X and Linux, C:\Documents and Settings\user\.android\ on Windows XP, and C:\Users\user\.android\avd on Windows Vista, 7.
There name.ini and name.avd folder
- copy the folder for example: C:\
- modifiy the path in the .ini to path=C:\name.avd
I had a similar problem because of non-latin letters in my username.
When opening the ini-file in a text editor I found the non-latin characters was wrong. So I just changed the path from
path=c:\Users\YourNa¤%"%¤%%¤me.android\avd\YourAVDName.avd
to
path=c:\Users\YourName.android\avd\YourAVDName.avd
and it worked.
To make sure everything is installed correctly, I recommend you reinstall all the components. To be sure everything goes correctly follow my step by step instructions on my blog.
http://androidcodemonkey.blogspot.com/2010/01/how-to-setup-android-development_23.html
If you follow all the steps you should be good to go!
Good luck.
I had the same error. What I found was that I was missing
ARM EABI v7a System Image.
I fixed it by opening the Android SDK Manager (The tool bar button looks like a little white arrow in a gray box with green android head)
I checked the missing system image and clicked the install button.
See this topic.
I also had the same problem since my username was in Cyrilic letters Димитров.
I change it to a latin alphabet and then it's OK.
You have to use Android tool from sdk\tools folder to move your AVD device to some Folder with no foreign characters in the path.
Just type android move avd -n "nameofdevice" -p "newpath"
For example: android move avd -n HTDDESIRE -p C:\HTCDESIRE
I agree with Zian, something is seriously wrong here and you should consider reinstalling. Also make sure of the following:
1) Make sure your avd folder looks sane. This can be found in the .android directory in your home directory. Look in ~\.android\avd\<name-of-avd>.avd\ and you should see config.ini and userdata.img files, plus an sd image if you created one. Make sure your config.ini looks something like this:
hw.sdCard=yes
hw.dPad=yes
hw.accelerometer=yes
hw.lcd.density=160
skin.name=HVGA
skin.path=platforms/android-1.6/skins/HVGA
hw.trackBall=no
hw.ramSize=256
image.sysdir.1=platforms/android-1.6/images/
Or, if you don't have any custom settings, then it will just consist of this one line:
hw.lcd.density=160
2) Make sure you have the latest version of the ADT Eclipse plugin (v0.95).
3) Also, you really truly shouldn't have any permissions problems within your home directory, but hey, it's Windows -- you never know. So you may want to manually set the permissions to the avd/ folder to read/write/execute, just to be sure.
4) Other than that, reinstall with extreme prejudice!
Try to download again the SDK, unzip it and reinstall through Eclipse.
Be sure to have the last version and have configured all the paths in Eclipse preferences correctly.
If you have installed the Android SDK to a different drive ie not C: then you might need to set the ANDROID_HOME environment variable to the location of the SDK installation
Another consideration I may have overlooked in others answers - I see you mentioned Eclipse 3.5 - consider using 3.5.2 (the current latest version)
May not matter, may have just been omitted by you, either way using the most up to date stuff never hurts.
One way is to don't exit the emulator after running. You edit the program without closing emulator. Do it every time.
This solved it for me on IOS: I looked in the actual .ini file for the device (Nexus-7-inch-tablet.ini) which looked like:
avd.ini.encoding=ISO-8859-1
target=android-17
path=/Users/stevensanborn/.android/avd/Nexus-7-inch-tablet.avd
path.rel=avd/Nexus-7-inch-tablet.avd
and removed and extra return space in the file. Resaved it and worked. Ridiculous.
The solution (that worked for me) was to add the following missing entries in my avd's config.ini:
image.sysdir.2=system-images/android-14/armeabi-v7a/
image.sysdir.1=add-ons/addon-google_apis-google-14/images/armeabi-v7a/

Categories

Resources