Related
After typing cordova run android in terminal, I'm getting this error:
Waiting for emulator to start...
PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/Users/username/Library/Android/sdk]!
This happens after exporting:
export ANDROID_SDK_ROOT='/Users/username/Library/Android/sdk'
Before exporting I got:
Waiting for emulator to start...
PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT
Any ideas where I'm going wrong? I'm sure this is the sdk root so why am I getting broken avd system path?
There are may be several different problems when you move your AVD or SDK to another directory, or replace an old SDK with a new one, or somehow get the SDK corrupted.
Below I'll describe all the possible problems I know, and will give you several ways to solve them.
Of course I assume that you have any AVD created, and it is located in C:\Users\<user_name>\.android\avd (Windows) or ~/.android/avd (Linux/MacOS).
If you moved .android to another place then set the ANDROID_SDK_HOME environment variable to the path of the parent dir containing your .android and make sure the AVD Manager successfully found your Virtual Device.
Also check paths in <user_home>/.android/avd/<avd_name>.ini
Incomplete/corrupted SDK stucture
PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT
PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value
These 2 errors happen if the emulator cannot find the SDK, or the SDK is broken.
So, first of all I recommend to remove the ANDROID_SDK_ROOT variable at all. It's only needed when the emulator is located outside of the SDK directory. But in general, your emulator stays inside the SDK dir. And in this case it must detect the SDK location automatically. If it doesn't, then your SDK probably has wrong filetree. Please do the following:
Check that the SDK directory has at least these 4 directories: emulator, platforms, platform-tools, system-images. It is very important! These directories must be present. If some of them don't exist, then just create empty dirs.
Go to <user_home>/.android/avd/<avd_name> and open config.ini. Find the image.sysdir.1 property. It points at the directory, inside the SDK directory, that contains the actual system image. Make sure that this directory exists and contains files like build.prop, system.img, etc. If it doesn't, then you have to open the SDK Manager and download system images your AVD requires (see below).
If everything's set up properly, when these errors about ANDROID_SDK_ROOT must be gone. If they're not, then now you may try to set up ANDROID_SDK_ROOT variable.
Required packages and HAXM are not installed
The next problem you may face is that the emulator starts to launch, but hangs up or quits immediatelly. That probably means that you don't have all the required packages installed.
Another possible error is:
Could not automatically detect an ADB binary. Some emulator functionality will not work until a custom path to ADB is added in the extended settings page.
So, to successfully launch any AVD you must be sure that at least these packages are installed:
emulator (Android Emulator)
platform-tools (Android SDK Platform-Tools)
tools (Android SDK Tools)
And as I mentioned earlier you must install system images your AVD is using, for example system-images;android-25;google_apis;x86
Note that the most recent versions on SDK don't have a standalone SDK Manager.exe. Instead of it you have either to use Android Studio, or tools\bin\sdkmanager.bat (Linux/MacOS probably have sh files).
To list all available packages use sdkmanager --list or sdkmanager --list --verbose
To install packages use sdkmanager <package1> <package2> ...
Also I recommend to install HAXM on your system manually.
Qcow2-files refer to incorrect/nonexistent base-images
The last problem I'll mention happens when you're trying to move AVD or SDK from one computer or directory to another. In this case you may get such error:
qemu-system-i386.exe: -drive if=none,overlap-check=none,cache=unsafe,index=0,id=system,file=C:\Users\<old_user_name>\.android\avd\<avd_name>.
avd\system.img.qcow2,read-only: Could not open backing file: Could not open '<old_sdk_dir>\system-images\android-22\google_apis\x86\system.img': Invalid argument
There are 2 ways to fix it:
If you don't care about the data the AVD contains, just delete all the qcow2 files from the AVD directory (e.g. from <user_home>/.android/avd/<avd_name>). In this case you will get a clean version of Android, like after a hard reset.
If the data on the emulator is important to you, then open all qcow2 files one by one using any HEX editor (I prefer HxD), find the path of a base img file, and change it to the correct one in the Overwrite mode (to preserve the file size). Then select the path and get its length in hex (e.g. 2F). 2F represents the ASCII slash /. Put it into position 13:
PS: Not sure, but there are probably some utilites like qemu-img allowing to set different base image. Well, to me it's easier to manually edit the binary.
Now you'll probably be able to successfully launch your Android Virtual Device. I hope so :)
On Mac:
I had installed android-sdk using brew as well as Android Studio. Somehow, having 2 installations was causing this problem. When I uninstalled my brew installation of the sdk using brew cask uninstall android-sdk and added the following vars to my env. It worked.
export ANDROID_HOME=/Users/<Username>/Library/Android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
This will solve your problem in macOS:
pico ~/.bash_profile
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export ANDROID_SDK_HOME=/Users/$USER/Library/Android/sdk
export ANDROID_AVD_HOME=/Users/$USER/.android/avd
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_AVD_HOME
source ~/.bash_profile
It means that your path to tools is incorrect. This is what it looks like on a mac using brew. Mind the version.
export ANDROID_SDK_ROOT='/usr/local/Cellar/android-sdk/24.4.1_1'
In your case it looks like you should run this:
export ANDROID_SDK_ROOT='/Users/username/Library/Android/sdk'
Removing the Error While Using Homebrew's Android SDK as the Default SDK
As #EFreak did I installed the android-sdk with homebrew (a package manager for Macs). I needed to do the below to fix the error, because I was following the nativescript tutorials and ran into the error. If you like me intend to use the brew version over the android-sdk version use this answer (this will allow you to use nativescripts tns run android api), and if you want the android studio default android-sdk follow #EFreak's answer.
Configuring Android Studio to use the Homebrew's Android SDK's
Basically you just need to change your Android SDK location in Android studio. First open a project in android studio. Then open the SDK Manager by clicking this button.
Next when the default preferences for the android SDK manager comes up you need to click edit next to the android SDK location.
Finding the Location of Homebrew's Android SDK
Next you need to actually update the sdk location on the sdk components setup screen my brew android-sdk was located here /usr/local/share/android-sdk. You can find where yours is installed by running brew cask info android-sdk then near the bottom of the output it should say:
You can control android sdk packages via the sdkmanager command.
You may want to add to your profile:
'export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"'
The value of the exported ANDROID_SDK_ROOT variable (which here is /usr/local/share/android-sdk) is home-brew's location of the android sdk.
Then you need to click the Android SDK Location button (labeled as 1 in the picture) and paste in Homebrew's Android SDK location.
Then just finish up the wizard by installing whatever packages. I needed to delete and recreate my device emulators at this step, but it seemed to work great after that.
Setting the Android SDK Environment Variables to Point to Homebrew's Android SDK
Also you may want to make sure if you are going the Homebrew route that your profile settings script has the ANDROID_HOME and ANDROID_SDK_ROOT environment variables set to your Homebrew location of the android sdk otherwise the above won't work yet. This can get changed from the Homebrew location if you installed Homebrew before installing Android Studio as pointed out in this answer by #Jamie Armour. You can check the environment variables for the android sdk are set correctly by running echo $ANDROID_HOME and echo $ANDROID_SDK_ROOT and verifying that they both show the Homebrew location of the android sdk.
If you need to change the ANDROID_HOME and ANDROID_SDK_ROOT values you can do this in your profile settings in your Mac which would likely be in something like ~/.bash_profile, "~/.bashrc", or "~/.profile" and defined like so:
export ANDROID_HOME="/usr/local/share/android-sdk"
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
You need to change the values of both the exports to the proper values of Homebrew's android SDK location then save the file. To verify that the right values have been written you should first either close and open your terminal which should rerun the file and reset the environment variables or you can source the file by running source <profile file name> where is the profile file you edited and saved. You then can rerun echo $ANDROID_HOME and echo $ANDROID_SDK_ROOT to verify that they have the Homebrew android sdk location.
I had same problem in my Windows10,
Isolved my problem by following the steps below.
open Android Studio
- Tools
- SDK Manager
- copy Android SDK Location
Android SDK Location
set system environment variable
ANDROID_HOME and ANDROID_SDK_ROOT
system environment variable
I had the same issue after emulator update. Problem was resolved after adding variable ANDROID_AVD_HOME
Important: Non-ASCII characters cannot be used in the path.
Finally reinstall virtual devices or manually override device path in Configuration settings.ini file which contains old path with non-ascii characters.
C:\Users\<user_name>\.android\avd\<avd_name>
Platfoms directory was missing in /usr/local/share/android-sdk.
I created an empty directory named platforms that fixed the issue.
In my case it was broken because ANDROID_HOME and ANDROID_SDK_ROOT were different, so once I set ANDROID_HOME to be the same as ANDROID_SDK_ROOT then it started working.
I ran Android Studio on Windows 10, set ANDROID_HOME and ANDROID_SDK_ROOT on Environment Variables, and still got the error.
Turns out, I forgot to download the device.
After downloading the "Missing system image", everything works fine.
Oleg Cherrs answer led me to a solution. As he mentioned
Go to /.android/avd/ and open config.ini. Find the >image.sysdir.1 property. It points at the directory inside SDK containing system >images. Make sure that this directory exists and contains files like build.prop, >system.img, etc. If it doesn't, then you have to open the SDK Manager and >download system images your AVD requires (see below).
I found the corresponding emulator *.ini file in the avd directory.
There I modified the "image.sysdir.1" entry. I replaced the relative with an absolute path (append the ANDROID_SDK_ROOT in front). After that the emulator started from the command line as expected.
I'm in Windows 10 and the problem was that the avd's directory in my computer had non-ASCII characters in it.
Here's what to do:
Run cmd as administrator
Run the following command:
mklink /D C:\\.android C:\\Users\\-yourUsername-\\.android
(This will create a symbolic link between the path with non-ASCII characters and the new one)
In enviroment variables add ANDROID_AVD_HOME variable with value C:\\.android\avd.
A fix if your user contains non-ASCII characters
For people getting "PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT", the reason for this might be that your user in users contains non-ASCII characters.
Therefore both the SDK and .android folder with the AVD folder need to be moved to another folder.
Changing the SDK path:
Open Android Studio, go to configure, and choose the SDK Manager. Change the current Android SDK Location to e.g "C:\Android\Sdk" (Or somewhere else, just not in the user folder containing non-ASCII characters).
After this, add the following system variables:
ANDROID_SDK_ROOT C:\Android\Sdk
ANDROID_HOME C:\Android\Sdk
Changing the AVD path:
To change where the AVD folder is placed (Normally placed in "C:\Users\<user name>\.android\avd"), you need to change where the .android is placed. First close Android Studio, then add the system variable ANDROID_SDK_HOME with the path to the new place you want .android to be, e.g C:\Android_SDK_HOME as used in another example:
ANDROID_SDK_HOME C:\Android_SDK_HOME
After you added this, run Android Studio. Then close it again. Now a folder called .android should have appeared.
The next and last thing you need to do is to set the ANDROID_AVD_HOME system variable. In this case that will be in C:\Android_SDK_HOME\.android\avd
ANDROID_AVD_HOME C:\Android_SDK_HOME\.android\avd
I hope this resolves the problem for some. :)
ok i can run android from cordova, i changed ANDROID_HOME to,
export ANDROID_HOME=/usr/local/opt/android-sdk
You should add AVD Emulator.
Go to this location:
C:\Users\%username%\AppData\Local\Android\sdk\
start AVD Manager and in the second tab(Device Definitions) click on the button "createAVD".
All you need to do is install the platform for the desired emulator example for android 11
sdkmanager --install "platforms;android-30"
after you do this your emulator will start working just fine.
I had the same issue which after setting following path variables got vanished
Note AVD Home path is different from other three.
Check if the system image used by your AVD has been downloaded under $ANDROID_SDK_ROOT/system-images/
Just ran into that issue today and managed to solve it.
Emulator: [140735565005632]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at /Users/your_user_name/Library/Android/sdk/emulator/lib64/qt/lib
15:08 Emulator: Could not launch '/Users/your_user_name/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64': No such file or directory
The solution was pretty simple. Just install Android emulator through Android Studio => tools => Android => SDK manager => SDK tools => select Android Emulator => Apply
I'm using a MacBook Pro on macOS High Sierra, and I believe your machine has nothing to do with this issue. The emulator is not obviously installed when running the Android Studio installation manager for the first time, at least for me, with Android Studio 3.0.1
Also make sure you have your paths defined in your .bashrc or .zshrc like this:
export ANDROID_HOME=/Users/your_user_name/Library/Android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
NativeScript
For anyone having trouble launching the android emulator via NativeScript, it's likely env vars ANDROID_HOME and ANDROID_SDK_ROOT have been overridden.
How I managed to create a problem for myself was by installing Android Studio to generate a different emulator. I did this after I had already installed the android sdk via home brew.
So if during the NativeScript installation, you selected to install android sdk via HomeBrew, NativeScript will set the above as follows:
ANDROID_HOME=/usr/local/share/android-sdk
ANDROID_SDK_ROOT=/usr/local/share/android-sdk
Subsequently installing Android Studio will override these values as:
ANDROID_HOME=/Users/[User]/Library/Android/sdk
ANDROID_SDK_ROOT=/Users/[User]/Library/Android/sdk
So naturally there is a conflict with Android studio and the NativeScript/Brew installation of the android sdk. Removing one or the other and/or verifying that the env variable contain the correct path should get your emulator to launch.
Delete early created devices.
Close Android studio.
Open: Control panel -> System & security -> System -> Advanced system settings ->
Environment variables.
Create New variable "ANDROID_SDK_HOME" and set
new path(in my case it was F:\Coding2019\Android\AVDdevices). Push 'ok'.
Open Android Studio.
Create new device. After creating in drop-down menu click "View Details" to see new path of new AVD.
中国的小伙伴注意!原因是avd目录不能包含中文
I tried all these method above, and I still get the error, and I wonder if it's because my avd directory contains chinese charactor. so I change The default avd directory by the following steps, and it worked.
1. create a folder whose path doesn't contain non-ascii character
2. copy or cut the default avd folder $HOME/.android below the folder you just created
3. add PATH ADNDROID_SDK_HOME, and the Android studio will find avd below $ADNDROID_SDK_HOME/.android/avd
finally it worked out! :>
In Windows 10 (without Android Studio) I solved the "PANIC: Broken AVD system path" by transferring '.android' folder from its default place in "C:\Users\Леон" into SDK folder. And change Environment as
ANDROID_SDK_ROOT=D:\Android\SDK
ANDROID_AVD_HOME=%ANDROID_SDK_ROOT%\.android\avd
ANDROID_EMULATOR_HOME=%ANDROID_SDK_ROOT%\.android
I suppose the problem might be either in non-ASCII symbols in my USER's path or they need to be "all together"
After quite some time trying other Googled "solutions", the only thing that worked for me, after setting the ANDROID_SDK_ROOT environment variable on Windows, and also adding and removing ANDROID_HOME and ANDROID_SDK_HOME variables, was Xerox23's answer - editing the AVD's config.ini to hardcode the value of ANDROID_SDK_ROOT into the image.sysdir.1 property.
This was using Android Studio 3.0.1 and emulator 26.1.4, launching the virtual device from the AVD Manager from within Android Studio.
For windows machine: After trying alot of set path, remove path and etc.
What finally work is to located the folder C:\Users\johndoe\.android and delete it. after that you can lunch your Android Studio, it will ask you to download and install a new AVD and it will override and create a fresh new folder and files. This solve the problem.
To solve this problem I had to install the package with the missing system image using SDK Manager.exe (in "C:\Program Files (x86)\Android\android-sdk"). I had noticed that the system image I needed ("android-23") was missing in "C:\Program Files (x86)\Android\android-sdk\system-images".
After running SDK Manager.exe and installing the appropriate packages I could run the emulator in Android Studio.
Here's the solution that worked for me:
https://www.embarcadero.com/starthere/xe5/mobdevsetup/android/en/creating_an_android_emulator.html
Follow below steps this should solve your problem
1.
export ANDROID_HOME=/usr/local/Cellar/android-sdk/24.4.1
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/bin
2.
Go to android studio preferences => Build, Execution, Deployment => Build Tools => Gradle => Android studio => Enable embedded Maven Repository should be selected.
3.
Go to android studio preferences => Appearance & Behavior => System Settings => Android SDK => Go to SDK Tools and select Android Emulator
The errors actually vary. It's helpful to run ./emulator with -verbose option, as it will show the actual errors.
I solved this problem by removing the file /usr/local/share/android-sdk,
because this file was created when I tried with homebrew .
export ANDROID_HOME=/Users/<username>/Library/Android/sdk
export ANDROID_SDK_ROOT=/Users/<username>/Library/Android/sdk
export ANDROID_AVD_HOME=/Users/<username>/.android/avd
that is enough ....
Open your android studio then focus on the toolbar.
Goto tools > SDK manager then
Appearance & Behavior > Systems Settings > Android SDK
Now in the tab copy the Android SDK Location from here
Android SDK Location
then goto your environment variables and then set the path along with these variables
ANDROID_HOME
ANDROID_SDK_ROOT
Environment Variables
When I try to open up the SDK Manager in eclipse it says opening shortly, but never opens. I've tried to open the exe file but it displays an error message saying:
Failed to execute tools\android:bat the system cannot find the file specified
My path environment variable leads it to the tools folder.
This is the path:
C:\Users\Shan\Documents\Computer Science - YEAR 2\Android App Development\adt-bundle-windows-x86-20130917\sdk\tools
In my case the Tools directory just disappear.
..\sdk\tools
To solve it:
1) Just go to SDK zip -> adt-bundle-windows-x86_64-20131030.zip
2) Unzip the Tools Directory only.
3) copy it under ../sdk/
I had a similar problem today. Press the Windows button and Search for android.bat(in the search programs and files text field)
Then copy the file to your android SDK folder (C:\Users\Shan\Documents\Computer Science - YEAR 2\Android App Development\adt-bundle-windows-x86-20130917\sdk\tools\).
After that don't run SDK manager but run the android.bat file.
Hope this helps
-Zaniar
I had to move the AVD manager from /sdk/tools/lib to the root folder /sdk
Copy the AVD Manager.exe and SDK Manager.exe from
SDK_ROOT_FOLDER/tools/lib/
into
SDK_ROOT_FOLDER
I've been working with this problem for three days and finally was able to run SDK Manager by
==> Running the android.bat file as administrator
Note: I did not have to make any changes to the .bat file (such as setting the java_exe path) in order for the manager to run.
I saw this as a comment on the top answer but can't upvote yet, so confirming it here!
I cancelled an update to Android Tools and it seems there's a bug with unzipping the old (or new?) version back into {android_sdk}/tools. The zip is located in {android_sdk}/temp. Just unzip it into the right location and it should work again.
If the accepted answer doesn't help anyone, it also might be a permission issue (if the SDK is installed in Program Files (x86), for example, so try running android.bat as Administrator,
I had the same issue when updating the Android SDK Tools and SDK Platform-tools from the SDK Manager. I had to replace the tools folder with one located in a zip folder inside the temp folder.
In My case, While I installed visual studio 2015, The SDK files were missed and I am getting an error window shown below.
So I manually downloaded the tools from the following URL.
tools_r24.0.2-windows
Then extract the zip file and copy the tools folder in the following location.
C:\Program Files (x86)\Android\android-sdk
It worked for me.
I think current Android SDK only works with JDK x86 version. I search so much but when installed JDK x86 version Android SDK manager worked without problem.
Copy your android.bat file to C:\adt-bundle-windows-x86_64-20140702\sdk\tools folder or copy all files to C:\.
If you are seeing this error, it may be an issue with your COMSPEC environment variable.
Please see https://stackoverflow.com/a/27284746/3866013 for more details.
I had the same problem. Caused it myself because while runing Android SDK Manager i hit UNINSTALL SDK Tools.
I fixed the issue by running the installation of the Android SDK again. The installation folder had to be the same as previously. After the installation, everything was back again as it was.
This is how I solved the problem on Windows 7:
I was going to update the SDK using Android SDK Manager but android.bat was not found because previously it uninstall the older one and then installs new. In my case my SDK Update was interrupted i.e. in other words, could not install after the SDK Manager uninstalled the tools, so my machine was not able to find android.bat. What I did was just downloaded the standalone SDK tools to the same folder where my SDK were from :
http://developer.android.com/sdk/index.html#Other
https://developer.android.com/sdk/index.html#Other
Here are two options for downloading the Android SDK for Windows users. One in recommended option and the other is .zip file. Zip file worked well.
Another option may also work. Try searching android.bat with windows search engine. If you find the one, copy it and paste in SDK tools folder.
open Sdk Manager.exe, then i deleted first Android Sdk tools, so, I also appeared such a mistake, then I downloaded installer_r24.3.2-windows.exe, installing, copy C:\Users\Super Man\AppData\Local\Android\android-sdk\tools folder to my Sdk path,run My Sdk Path\android.bat ,ok!!
I did the following :
I created a folder SDK right below my C-drive
I unzipped tools_r25.2.3-windows.zip to C:\SDK
I moved SDK Manager.exe from C:\SDK\tools\lib to C:\SDK
I first ran SDK Manager.exe in 'normal mode',but this gave me the error, but when I ran SDK Manager.exe as ADMINISTRATOR it didn't return the error.
The reg command exists but for unknown reason my path variable was corrupted during some installation.
So some basic element were missing:
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem
I'm trying to upgrade the Android SDK tools from revision 15 to revision 16. The update fails, claiming that a "folder failed to be moved":
Failed to rename directory C:\android-sdk\tools to
C:\android-sdk\temp\ToolPackage.old01
I tried disabling my antivirus (as this problem has been reported by some people in 2009), and it didn't work. A fresh reboot didn't work, either. I'm encountering this problem on two different Windows 7 machines.
I did not encounter this problem upgrading from previous revisions all the way up to revision 15.
Anybody knows how I can circumvent this?
Extracted from here:
INSTRUCTIONS:
make a copy of the tools directory and call this new directory tools2.
DO NOT USE 'SDK Setup.exe'.
Instead open up a cmd.exe window as administrator and run the following from this new tools2 directory (obviously the full path on your local machine
will be different):
J:\android-sdk-windows>tools2\android.bat update sdk
Basically, as noted before in this thread, 'SDK Setup.exe' invokes
tools\android.bat, which makes it impossible for it to rename the
tools directory thereafter. It's a bit goofy and should never have
passed QA validation..
If you are unable to update Android SDK tools. Simply download the zip of android tools of version you want, and then replace the new tools directory with the old one. Then you are ready to go !!
Update SDK version using Eclipse (button Open the Android SDK Manager), running android.bat from a local copy of tools directory didn't work for me.
Replace android.bat with latest version (r18).
It should be zipped in android-sdk/temp
Worked for me.
you need Eclipse 3.6 Helios or 3.7 Indico to upgrade your ADT revision 16.
It wont be upgrade in Eclipse 3.5 Galileo.
New: December 12, 2011 - SDK Tools and ADT 16 released.
NOTE: ADT 16 requires Eclipse 3.6 or higher.
http://developer.android.com/sdk/requirements.html
Remove Platform tools folder and close eclipse that worked for me api17
First, you need to update ADT for your eclipse, my eclipse version is indigo
Then you can click "open android sdk manager" button to update your sdk to ver16
I have tried many method and this method help me to update it.
If none of above worked, try this:
Run task manager and close all java.exe instances.
Goto android-sdk-windows\temp and open tools_rXX.X-windows.zip ( replace X
by latest version you've downloaded), now copy and replace it's content to
tools folder.
To add to Subash's answer, if you have already attempted the upgrade, the tools zip file you need is in the android-sdk\temp folder.
I know this is an old post but I want to write my personal solution to the problem:
Failed to rename directory C:\android-sdk\tools to C:\android-sdk\temp\ToolPackage.old01.
Obviously I have had the same issue and every time the Android tools needs to be updated it's a nightmare.
None of the solutions I found googling the net worked for me up now, but this is a vital job to maintain Android SDK updated. So I started to find an alternative working way to solve this issue and I found it finally.... at least... it works for me, even if it is a bit tricky.
The basic problem is that the android.bat batch file comes from the ~\tools\ folder and it's still in memory (running) while the same ~\tools\ folder needs to be updated (in our case, renamed).
The problem is that the android.bat runs java to launch swt.jar (the SDK tool), and it remains uselessly waiting for completion of this java program.
You can edit the android.bat and see the call in the latest row of this batch:
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 problem is the "call" CMD command. It waits for the called external program completion.
But ther's another way to run external programs from a batch file: the "start" command. It launches an external program and terminates.
So I just replaced the "call" command with "start", so that after the change the latest row of my android.bat was:
start "" "%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 %*
Note: Keep the "" in between start and the application path. You can add text in those hyphens and this text will be the caption of the java.exe command window you will see after the changes. In my case I left the caption as an empty string but you can write there what you want.
After the changes, you can start the SDK and the android.bat will be no more waiting, leaving the SDK tool free to play (and rename the ~\tools\ folder without headaches).
Obviously, after updating the SDK tools, you have to redo the same changes in the new, updated android.bat batch file. This could be a bit unconfortable, but you'll have just to remember to make the changes before running the SDK tool and you'll have no other headaches while updating Android.
#SERPRO solution.
Warning, this solution downloads ALL packages for all API (levels). It works, but it is very slow and perhaps worse than just backing up your folders and re-installing the SDK (all together). At least this is my experience for Windows Vista + Cygwin.
More than one bug-report have been issued. Here is one of the later ones, but it seem that it is never resolved. (It's already 2 years old.)
On Windows8, upgrading from SDKr19 to 20, I got the cannot move folder error. It's at least handled a bit by the SDK installer, with error message and chance to retry.
Right click cmd.exe, select Open as Administrator, cd to SDK directory (mine was default)
cd C:\Program Files\Android\android-sdk
Now run the SDK manager, except this time you'll be as Admin and it'll be able to move folders etc. So run it by typing:
"SDK Manager.exe"
Follow standard upgrade procedure
I think for those who still have the problem even if they already followed the answers here, try to see the processes in your system. Even if you close eclipse, sometimes it is still running in the background. So you can stop the process from the task manager.
It's very simple. Follow these steps:
Download windows installer r_20sdk for android.
To install it on your system run SDK.
Install all packages.
Go to eclipse, navigate to window - preference - click android.
Give the path of your sdk click apply and ok now run you SDK manager.
Note: when you install sdk with the help of windows installer r_20SDK note the path or search the path in window search copy this.
I tried all the various suggestions short of uninstalling and reinstalling the whole sdk and still got the error, including disabling thumbnails, which is the most common suggestion for folders you can't rename. I downloaded the free "processexplorer" from Microsoft to see what processes were using the folder, and after disabling all startup and non-Microsoft processes and finding no processes to be using the platform-tools folder, I still got the error, and found I couldn't rename it after the upgrade attempt.
The solution for me was to copy and paste the platform-tools folder found in the 'temp' folder in the android-sdk folder. Every upgrade I find a copy of the platform-tools in there, although for version 19 the platform-tools was zipped and the temp folder included versions of 18 and 17 which I left.
I have closed every window, restarted the computer. But Eclipse is telling me: "C:\Program Files\android-sdk\tools is being accessed....I even deleted the directory but I still get : how to fix?
Failed to rename directory C:\Program
Files\Android\android-sdk\platform-tools to C:\Program
Files\Android\android-sdk\temp\PlatformToolPackage.old01.
I have had this problem on Windows too. Instead of updating it through Eclipse, try the stand-alone option:
Close Eclipse
Open a Command Prompt window (ideally in
Administrator mode)
Run the command "android"
If you have the SDK tools directory in your path it will open the same UI you get in Eclipse but without additional file locking. If it is not in your path have a look in C:\Program Files\Android\android-sdk\tools and run "android.bat" from there.
Also, once you have updated the SDK, don't forget to fire up Eclipse and, on the Help menu, click "Check for Updates". You may well find the ADK Eclipse plugin needs to be updated too - this often goes in step with SDK updates.
Supposedly, if you use the SDK Manager.exe program rather than tools\android.bat, it works. However, I've never had any luck with that.
My traditional approach has been:
Duplicate the tools\ directory to create a foo\ directory
Adjust your PATH and other environment variables to point to foo\
Run the tools\android.bat out of foo\
Do the upgrade, which should work
When done, close out of the SDK and AVD Manager, revert your PATH and such to point back to tools\, and get rid of the foo\ directory
I'm guessing that adb is restarting with the computer. Try adb kill-server before upgrading
Another simple fix:
Close Eclipse. Open the directory where your SDK is located (C:\Users\user35\android-sdks) and run SDK Manager (as Administrator).
First, I know this problem has been asked before, namely : Could not find adb.exe on my tools folder
but I tried every answer given and none work (even the accepted answer).
My problem is that I updated the Android SDK and now Eclipse cannot find adb.exe. I know where it is, it is in platform-tools directory, but I can't get Eclipse to read it from there. I updated the path.
Now what has happened is, in all my projects the asset folder is empty, meaning there is no android jar file.
Also, clicking on the SDK update manager from inside eclipse does nothing. I have no idea why.
Lastly, if I try to install new software in Eclipse (ADT update?) it wont allow it.
In the project -> preferences tab I get the following message:
Could not find C:\Program
Files\android-sdk-windows\tools\adb.exe!
I'm working on Windows 7 with Galileo eclipse.
Can anyone offer any help?
The adb tool has moved to platform-tools/
If you don't see this directory in your SDK, launch the SDK and AVD Manager (execute the android tool) and install "Android SDK Platform-tools"
I also faced the same problem before but now i solved the problem by following the step below
Step 1: You know where your android-sdk is installed in your system if you didnt changed the location search in ProgramFiles/Android
step 2: close eclipse.
Step 3: Copy adb.exe in android-sdk/platform-tools/ folder
Step 4: Paste that adb.exe in android-sdk/tools/ folder
Step 5: Now open eclipse go to Windows --> Preferences choose android then click browse and select android-sdk with in few minutes it shows APK levels installed in your system press Apply
Solution is simple. Unfortunately I forgot you need admin rights. That's why eclipse wouldn't install new packages. I simply opened Eclipse as the Admin and everything went smoothly. Lost all my R.java files for some reason, but got them back by cleaning the project(s).
I think that's because adb has moved to
C:\Program Files\android-sdk-windows\platform-tools\adb.exe
I 've tried this once.. when i got similar problem on Windows 7 .. Copy adb.exe from platform-tools to tools folder. Now eclipse should work properly.
Yes on tools/adb_has_moved you can read:
"The adb tool has moved to platform-tools/ If you don't see this directory in your SDK, launch the SDK and AVD Manager (execute the
android tool) and install "Android SDK Platform-tools" Please also
update your PATH environment variable to include the platform-tools/
directory, so you can execute adb from any location."
the adb tool has moved to platform-tools/ but in my case no adb was in this dir but in windows 7 you can make backup of this folder (just go in folder properties->Previous version) and save backup instead of original. In my case it helps
I got the same problem. In my case it was caused by an upgrade on the Java JDK. I was using 1.6 and upgraded to 1.7.
Just manually add the new JDK to Eclipse.
Right click on your project JRE System Library. Select installed JRE, and then find it on your computer.