Can't upgrade Android SDK Tools - android

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.

Related

Cannot run XAMARIN UI TEST on xamarin.forms, error System.Exception

I want ton run Xamarin UI test, but when i run the test i have this error :
System.Exception : 'The running adb server is incompatible with the Android SDK version in use by UITest:
C:\Program Files (x86)\Android\android-sdk
my start command-line :
return ConfigureApp.Android.ApkFile("/Users/Jerem/source/repos/App4/App4/App4.Android/bin/Debug/com.companyname.App4-Signed.apk").StartApp();
Thanks for our helping
If you have the same error, check in our sdk directory if you have platform-tools and platform-tools.oldxxxx, delete old ! Just work after
Y Nakamura's answer moved me in the right direction but it still took me a long time to solve because I wasn't sure exactly what I was trying to solve. I'm going to expand on the answer here in case others run into the same problems that I did.
As mentioned, the problem seems to be caused by the files (not sure if it's adb.exe or other files) inside of platform-tools not being supported by Xamarin.UITest. platform-tools can be found in C:\Program Files (x86)\Android\android-sdk
I had platform-tools folder, plus two additional folders with old12341234 suffixes (the numbers didn't make any sense to me).
To figure out which version of adb.exe is in each folder:
Open one of the folders
Hold shift and right-click in the windows explorer window to see the Open PowerShell window here option
In PowerShell, run the command ./adb.exe version to see the version number you are running
In my case, the version that was too new was 1.0.40. I found a folder that had 1.0.39. I renamed the platform-tools folder that was too new to platform-toolsTooNew. I then renamed the folder that contained adb.exe v 1.0.39 to platform-tools, then restarted Visual Studio.
After doing all of that, my automated tests once-again worked!
Update November 2020
I was able to run with a newer version of ADB, but I had to delete the old folder from my android-sdk folder. I am using:
ADB version 1.0.41
Visual Studio 16.6.5
Xamarin 16.6.000.1064
Xamarin.Android SDK 10.3.1.4
I'll keep my original post above in case it helps others.
Android SDK Platform-Tools 28.0.0 (40) is too new. Try restoring 27.0.1 (39). Open folder %ANDROID_HOME%. If the folders platform-tools and platform-tools.oldxxxx appears, rename them to restore old version.

Failed to execute tools\android.bat: solution

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

Android Studio Error: "You must install the Android Support Repository though the SDK Manager"

I just initialised a project on Android Studio, and it was working fine in version 0.2.6, but in 0.2.7, I get this error:
It creates a folder inside my Applications directory, but it does not initialize the project. Any help regarding this problem would be appreciated. I get no problems with version 0.1.1 through version 0.2.6, but when it comes to 0.2.7, things start to get problematic, like this and I can't even start a project.
With 2.7 update I got the same issue. It looks like now Android Studio thinks sdk lays in under its own folder at android-studio/sdk.
You should be able to use android app under android-studio/sdk/tools to get missing components (not tested).
Another solution would be to fix sdk path (tested):
Close any projects then drop to Welcome to Android Studio Dialog
Select Configure -> Project Defaults -> Project Structure
Select SDKs -> Android SDK -> Android SDK Home Path
Update it to your previous sdk location.
got the same problem when applying the last patch (2.7). I've resolved it by copying SDK Manager.exe from android-studio\sdk\tools\lib to android-studio\sdk\ then I've launched it and install the missing component.
After restarting Android Studio it works again !
You must manually run SDK Manager.
Folder: android-studio/sdk/tools
Search for android or android-sdk
The new Support Repository must be already selected, and you need only click the "Install" button.
Just as Leonidos said, install ASR through SDK Manager:
Tools > Android > SDK Manager ; Navigate to the Extras folder, and select Android Support Repositories.
Click install packages and it will work fine
I did a fresh install of Java, SDK and Android Studio, update it to 0.2.7 and install the ASR through SDK Manager, but the messages comes again.
So i found this solution.
The most common problem for Android Studio and 64Bit Windows System is the no 8.3 short path for
C:\Program Files and C:\Program Files (x86).
find_java.exe
couldn't handle it and give a wrong path back.
Finally do this:
dir /x C:
-- It shows no 8.3 short paths.
fsutil 8dot3name query C:
-- It shows NtfsDisable8dot3NameCreation is 1 on "C:",
means 8.3 short path won't be created in "C:".
Then I enable the generation of 8.3 short name by:
fsutil 8dot3name set C: 0
and create short names for C:\Program Files and C:\Program Files (x86) in windows recovery mode by:
fsutil file setshortname "C:\Program Files" PROGRA~1
fsutil file setshortname "C:\Program Files (x86)" PROGRA~2
And now dir /x C: can show the short names.
And now find_java.exe -s
can show the short path C:\PROGRA~1\Java\JDK17~1.0_2\bin\java.exe.
And now find_java.bat and android.bat can work good now!
source
Also copying SDK Manager.exe from android-studio\sdk\tools\lib to android-studio\sdk\
Just a few ideas to try that should hopefully help. These can be found by using Ctrl + Shift + A.
"Sync project with Gradle" - (it's also often in the toolbar with a green and yellow ball and a blue down arrow next to three android icons)
"Gradle" and select the ToolBox option; then hit the blue refresh icon to refresh all the gradle projects
"Project Structure..." (also available under File) Under the Libraries project settings you should see a valid reference to your support library. You'll also want to skim through everything to make sure everything else looks good with the project.
"Invalidate Caches..." (another available under File) Invalidate and restart. This one got me going again after the previous upgrade generated a bunch of errors.
Some of these may be redundant, but after having fought with similar issues in the past it's just a few easy things I've found to check.
If refreshing everything doesn't work you can always pull up the Android SDK from Tools -> Android -> SDK or from the toolbar with the blue/green boxy android that has a black down arrow. It should be next to the Sync Gradle button.
I update the Android Studio(AS) and see the same issue.
However, there is something slightly different about what I find out.
I actually have two sdks because I shift from Eclipse to AS.
Hence, I get one sdk in
c:\Program Files(x86)\Android\android-sdk
and anther in
c:\Android\android-studio\sdk.
And the real one that I use is in c:\Program Files(x86)\Android\android-sdk.
The important thing is that, I find that only one of the sdk setting is changed after the update.
Quick Start > Configure > Project Defaults > Project Structure
> Platform Settings > SDKs
1.7
JDK home path:
C:\Program Files\Java\jdk1.7.0_10
Android 2.2 Platform
Android SDK home path:
C:\Program Files(x86)\Android\android-sdk
Android 4.0.3 Platform
same as 2.2
Android 4.2.2 Platform
Android SDK home path:
C:\Android\android-studio\sdk <- it is modified after update!!!!
Android 4.3 Platform
same as 2.2
After fixing the path in 4.2.2, I could create new project successfully again.
For some reason, if you install Android Studio in the same directory as the SDK, this error will pop up. Just install it somewhere else.
For instance, I had it installed at C:\Android\, along with the SDK. Then, I decided to install it at C:\Program Files (x86)\Android Studio and it simply worked.

Android Studio Can't Find JDK Mac

I'm just trying out Android Studio. I imported a project from Eclipse, but every time I try
to run it I get this error:
"Cannot run program
"Library/JavaVirtualMachines?jdk1.7.0_10.jdk/Contents/Home/bin/java"
(in directory
"/Users/myname/Library/Caches/AndroidStudioPreview/compile-server"):
error=2, No such file or directory.
I just installed the latest JDK using the JDK 7 Update 21 dmg. Is it installing the jdk in a place where Android Studio won't find it? The dmg didn't have any options for where to install the jdk other than "Install for all users of this computer," which I did.
When I was using Eclipse I had no problems with running my programs.
Furthermore, the Project Structure option was no longer available after I updated earlier today. Instead I just get the message, We will provide a UI to configure project settings later. Until then, please manually edit your build.gradle file(s.)"
I'm not sure what to do to get my programs running again. Do I need to locate the jdk files and move them? Could I tell Android Studio where the files are actually installed?
The solution was easier than I thought: just go to File/Other Settings/Default Project Structure and click SDKs. There the JDK home path can be changed.
Yes changing the JDK path will work. If that doesn't fix your problem, as it didn't for me at first, uninstall your JDK and redownload and install it. Once I reinstalled mine, it worked flawlessly.

platform-tools\aapt.exe directory missing in android SDK

I'm trying to get 'hello world' working on the Android SDK with Eclipse. I'm following this tutorial step by step:
http://developer.android.com/resources/tutorials/hello-world.html
but i'm returned the error "Error executing aapt. Please check aapt is present at C:\android-sdk-windows\platform-tools\aapt.exe"
For some reason, the "platform-tools" folder does not exist under my installation. In its place I find "platforms" and "tools". Presumably, my SDK version is different to that used in the tutorial.
I can't work out what i need to change or update. Can someone please point me in the correct direction?
Thank you
Totally agree with izzy, but other times (usually on 64 bit OS machines or with multiple android platforms) when you install the latest SDK version the folder platform-tools had missing the "appt.exe".
To solve this you need to search on *android-sdk\build-tools* folder and subfolders like \build-tools\17.0.0 in my case, and you will find aapt.exe, other necesary files and lib folder, just copy it everything to android-sdk\platform-tools and it will be done.
sometimes you may get the error that it can not install because it can not create the temp folder to install the tools. You simply just need to run the SDK manager as administrator and this will allow it to all work out.
if we will face appt.exe issue (could not found) just Follow the below steps:
1. Just Read It(https://developer.android.com/studio/command-line/aapt2)
Navigate to (ctrl+find and search) com.android.tools.build > then go to aapt2 from this url (https://dl.google.com/dl/android/maven2/index.html)
Insert the version name you copied into the following URL and specify your
target operating system: https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/aapt2-version/aapt2-aapt2-version-[windows | linux | osx].jar
For example, to download version 3.2.0-alpha18-4804415 for Windows,
you would use: https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.2.0-alpha18-4804415/aapt2-3.2.0-alpha18-4804415-windows.jar
Extract the jar file, Change the name aapt2.exe to apt.exe
Copy and paste into your android-sdk -> platform-tools
Run the program, Issue will be get resolved
Note: Means you have to download and set the aapt.exe path in System Environment Variable
*What version of the SDK are you running? (1.5_r2 or something?)*
I would suggest updating your SDK and be done with it ;)
You can do so trough the "Android SDK and AVD Manager".
Eclipse:
menu->window->"Android SDK and AVD Manager"
You might also want to change this setting:
menu->window->preferences->install/update->(expand)->automatic updates
Run the Android SDK Manager and be sure that you have checked and installed Tools>Android SDK Platform-tools.
I believe this package is responsible for the folder in question here.
I just found aapt.exe file in my latest Android-SDK folder (Android_SDK\build-tools\28.0.3)
You can check your latest sdk build-tools folder
or
You can search on total Android SDK folder by file name
I was able to delete my version (28.0.3) and Android Studio reinstalled it. The directory location was
C:\Users\YourUserName\AppData\Local\Android\Sdk\build-tools

Categories

Resources