Error with SDK package download in Android Studio - android

java.io.IOException: Cannot download , response: 200 OK Warning: An
error occurred while preparing SDK package Android Support Repository:
Cannot download , response: 200 OK. java.io.IOException: Cannot
download
'https://dl.google.com/android/repository/emulator-windows-3833124.zip':
dl.google.com Warning: An error occurred while preparing SDK package
Android Emulator: Cannot download
'https://dl.google.com/android/repository/emulator-windows-3833124.zip':
dl.google.com. java.io.IOException: Cannot download ' Warning: An
error occurred while preparing SDK package Google Repository: Cannot
download

I had this similar issue below worked for me.
The solution for this is:
Run Android Studio as Administrator.
Re run the update.
It will work.

delete uncompleted download in "[Android SDK folder]\.downloadIntermediates". i solved my problem by this method.

you can manual download sdk:
https://dl.google.com/android/repository/platform-29_r04.zip
https://dl.google.com/android/repository/3534162-studio.sdk-patcher.zip
https://dl.google.com/android/repository/build-tools_r29.0.3-windows.zip
https://dl.google.com/android/repository/emulator-windows-6306047.zip
https://dl.google.com/android/repository/sources-29_r01.zip
https://dl.google.com/android/repository/platform-tools_r29.0.6-windows.zip
Unpack to
C:\Android\Sdk\platforms\android-2
C:\Android\Sdk\patcher\v4
C:\Android\Sdk\build-tools\29.0.3
C:\Android\Sdk\emulator
C:\Android\Sdk\sources\android-29
C:\Android\Sdk\platform-tools
Parsing
C:\Android\Sdk\build-tools\29.0.3\package.xml
C:\Android\Sdk\emulator\package.xml
C:\Android\Sdk\patcher\v4\package.xml
C:\Android\Sdk\platform-tools\package.xml
C:\Android\Sdk\platforms\android-29\package.xml
C:\Android\Sdk\sources\android-29\package.xml

I have a similar problem.
And I notice some setting about Force https//... to be fetched using http://...
After using it, my download run normally:

run the studio.sh script with sudo:
"sudo ./studio.sh"
if that does not work run:
"sudo chmod 777 -R /opt"
without quotes
should work

Find Android SDK folder. (Usually C:\User\AppData\Local\Android\sdk) Delete folders which starts with dot(.), they are temporary download files. Then delete Android Emulator from SDK Manager. Then run Android Studio as administrator and then download and install Android Emulator again. Now you can create emulator and use it without errors.

Very often the cause of errors can be an interruption of the Internet connection.
Just resume downloading with stable Internet.

As shown in the android SDK video ./studio.sh has to be run, however if run without sudo or su, this might give problems like these. So you should run with sudo or su as shown below:
sudo ./studio.sh(or /path/to/studio.sh)
or if you want to run as root
su
Password:root password
./studio.sh or (or /path/to/studio.sh)
This should fix the problem
There might be a problem with /tmp if it is on a different partition and the partition has less space than needed to install
Hope this helps.

I had Admin access on my Laptop, but still I faced this problem (also other packages were getting downloaded). I found of that the https://dl.google.com/android/repository/android_m2repository_r47.zip file is quiet large, and in my case since my network speed was slow and I was attempting to download a large file on a slow network I concluded that it was failing for timeout. I switched to a faster LAN and it got downloaded.

I had the same problem, I downloaded problematic file 'https://dl.google.com/android/repository/emulator-windows-3833124.zip' and extracted it to
C:\Users\$usrname$\AppData\Local\Android\sdk\extras\android.
It solved the problem for me.

Hi I faced a similar issue... Turn's out that may be related to system configuration of your machine..
Try downloading latest packages as per your system configuration from below:
https://developer.android.com/studio/?gclid=Cj0KCQjwj9LkBRDnARIsAGQ-hUfGD0_yGXcqqZBN6d1Y-nMZ-TNKZtvdRBHimcE8m0tPYjyUw_bV77AaAsdzEALw_wcB

I had a similar issue while installing in Mac Catalina:
java.net.SocketException: Operation timed out (Read failed) Warning:
An error occurred while preparing SDK package Sources for Android 29:
Operation timed out (Read failed).
First attempt using standard configuration - Failed
Second attempt using standard configuration - Failed
Third attempt using Customer configuration, I selected the android simulator - Failed
Fourth attempt using Customer configuration, I selected the android simulator - Successful!
Not sure what was the reason, there is no change in any setting other than the above (and I am an Administrator of the Mac).

Below steps fixed the problem for me -
1. Download zip file from this location
2. Extract it and move the emulator folder image for emulator folder into the SDK folder image for SDK folder
I hope it works for you as well, I was using Windows 10 Pro 64bit

This amount of download requires high speed Internet and if you don't have this it may show this error.

As mentioned in the earlier comments, the problem might be because of slow internet connection, just to add more details, you need to download all the problematic file which you get in the logs, in my case they were (emulator-windows_x<>.zip and x86-30_r09.zip) and place them in the respective sub-folders (PackageOperation02 or PackageOperation05 ..) present in .tmp folder located under andriod-sdk root folder and retrigger the sdk installation from Andriod studio.
What Andriod-Studio will do after your action:
It will first search the files in .tmp folder if they exist it wont download and simply unzip and initiate the installation from where it failed.

I did not had android studio and was using only sdk manager. It was downloading to a location of <your path>\Android\.temp Directory.
Deleted the broken .zip file and re-ran the flutter run command.

Simply click on menu: File then click ->Invalidate caches
You may need to check optional if available
(clear file system cache and local history)
(clear vcs log cache and indexes)
Then click Invalidate and Restart.
This will solve your problem.
Thanks

Related

Initializing Gradle is taking forever on android studio for Flutter project

I'm trying to run a hello world flutter app for the first time on my device, but when I hit run on android studio, it shows initilizing gradle, and it stays like that for more than 20 minutes with no logging or error, I have an intel i5 as a CPU and I'm running it on Linux (dual boot, my download speed is quite slow (200 kb/s average download rate), in case this help
I installed the Flutter SDK and when I try adb devices on my machine it shows my device connected .
So why it's taking that time to run ? (until now it didn't run yet)
https://github.com/flutter/flutter/issues/15106
Please note riftninja's answer.
I look at this directory: C:\Users\myname.gradle\wrapper\dists
Yes, the gradle file is really big: 87M. You have to wait for a long time.
After this will be "Resolving dependencies....", which also slowly.
But finally it succeed.
I've faced the same problem, and my internet is currently very slow, so I solved it by changing the gradle in flutter project to an already downloaded one. Just follow these steps:
Go to C:\Users\YOUR_USER_NAME\.gradle\wrapper\dists
You should find one or more folders with the name of the distribution (for example with the name "gradle-4.6-all" if you were developing in Android Studio previously), choose one of these folders (make sure it is not empty) and copy its name.
Open Android Studio project explorer, and locate android\gradle\wrapper\gradle-wrapper.properties
You will find a line like this:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Change gradle-5.4.1-all with the folder name you copied in step 2.
Run your app, and hopefully it works this time.
When running flutter project first time even correct configuration it takes very long time.
That is because of downloading gradel and dependencies for particular version.If you ar noob Wait it to complete automatically till all files get downloaded. By using command:
flutter run <project-name> -v you can see whats happening in background.
To Manually downloading gradle zip and put to suitable directory. Go in Project Dir:
/android/gradle/wrapper/gradle-wrapper.properties and click on url and download it.
After Downloading it visit to :/Users//.gradle/wrapper/dists/gradle-4.10.2-all/9fahxiiecdb76a5g3aw9oi8rv your version path may vary
and paste downloaded zip inside it.
For Dependencies to download you need to wait depending on Internet speed.
It is one time process until next updated version and dependencies come UP.
Providing an active internet connection worked for me.
To build gradle offline,
For Windows,
Go to File -> Settings.
And open the 'Build,Execution,Deployment'. Then open the
Build Tools -> Gradle
Then check the box -> Offline work below.
Click the OK button.
For Mac OS,
go to Android Studio -> Preferences, and the rest is the same.
Goto Android Studio - File - Other Setting - Default Project Structure
Uncheck use Embeded JDk
Below, set your JDK path.
Found in Program files - Java - Jdk.
try to making use of flutter run -v which will basically giving the info which is running in background.
The problem is that Gardle is downloading dependencies and not using any way to show progress(This is NOT good for UX), so it is better to run gradlew.bat in the terminal and things will become more clear, like this:
Now it is much better, You can have a cup of coffee while watching it ;)

Android update causing error: Error:java.nio.file.AccessDeniedException: /home/path/.android/build-cache.lock

Updated Android Studio from version 2.3 to 3.1 Canary. But there seems to be a huge problem with Gradle.
Error:java.nio.file.AccessDeniedException:
/home/pathname/.android/build-cache.lock
What I did:
Deleted .gradle, thought it will solve the issue, but not, after rebuilding the project, .gradle again appears.
Deleted all android related things from system (SDK, Android Studio and remaining projects) and from zero started to download Android Studio with all required packages. Still, the same problem.
Changed android studio version from 3.1 canary to 3.0, also no success.
Looked at this post, but didnt help.
Read in some posts that this happens when Android Studio is corrupted. but I have downloaded from official site.
Any ideas how to fix it?
Open Android Studio as administrator..it worked for me.
I got the same error trying to Sync the project after an update. What solved the problem was giving the right permission to the .android folder, instead of running the studio on root mode (It would reinstall all SDK under root if you don't specify that you already have it under you user).
So, open the terminal and type:
sudo chown -R root:YOURUSERNAME /home/YOURUSERNAME_FOLDER/.android/
sudo chmod -R 775 /home/YOURUSERNAME_FOLDER/.android/
Easy fix, I hope it helps somebody.
Solved, in Linux I changed ownership and mode of the directory to that of below:
sudo chown MyUserName:MyUserName
// This allows to change from administrator access to user access.
Note it should be executed from
there, where your android studio is located. Either it might be in
/Home or /Download folder
sudo chmod -664 //This allowed files to be readable and writeable.
Reinstallation or other extra stuff dont seem to help, unless you do deal with proper root specification and file mode.
You can either start Android Studio as an Administrator. But this might be just a workaround and is not practically for some people. Fortunately, there is another way of avoiding this problem:
Open Explorer
Go to the folder where the build-cache file is located
Right-Click on it
Change the permissions for the file to have full access as a User
This should solve the problem and worked great with a similar problem (android.lock file actually!)
For me the access is denied on my project files when the debugger stores data when compiling. For me I had to give access to the file/folder then delete it. Worked for me.
In your project's main build.gradle, inside "allprojects":
allprojects {
repositories {
jcenter()
}
gradle.taskGraph.whenReady {
tasks.each { task ->
if (task.name.equals('mockableAndroidJar')) {
task.enabled = false
}
}
}
}
26Sept2019: I'm having the same problem, bcoz i'm doing a project in Ionic 4 i got this WARNING: API 'variantOutput.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'.
(first then)
Android update causing error: Error:java.nio.file.AccessDeniedException: /home/path/android,etc.,... so i've deleted the Android folder in the ionic project folder, for example path: /Users/homefolder/Desktop/CommunityLoginApp/android deleted this file or moved to trash then i did below:
Running the Ionic app on Android(without $):
ionic capacitor add android
ng build
ionic capacitor copy android
ionic capacitor run android( for 1st time run - it will automatically open the Android Studio)/ if any changes done: run ionic capacitor run android -l (for live changes on the simulator).io
It worked perfectly and also i got the build in my physical android but a INFO shows in the output panel and the WARNING changed to INFO now. Cooooollllll
Restarting windows works every time! It's strange but it works.

Installation did not complete successfully. see the IDE log for details - Android studio

I am updating my android studio but show me bellow error :
My android studio is 2.3.1
I had the same problem but starting the Android Studio in Administrator Mode has helped me to continue with the update.
The reason is that the SDK manager would write the location of the temp file where it downloads the installer. For example in OP's case its mentioned as below:
in a line form the log or error message
Due to some reason that file might not be available any more and Android studio instead of asking for a re-download would give this error.
The solution to fix this is to find the file .installData from where SDK manager is getting this info and delete it. This will force SDK manager to re download that component only and you don't need to download the complete SDK again
The content of the file looks something like this
#Tue May 16 18:41:10 GST 2017
class=com.android.repository.impl.installer.BasicInstaller
path=C\:\\Users\\user\\AppData\\Local\\Temp\\PackageOperation03
The content and path of the file would be different for different components
I got the same issue on Linux.
It was a permission issue on the SDK installation folder.
In Tools -> Android -> SDK manager there is the SDK installation folder at the top of the window.
Just do a chmod 777 -R on this folder, problem solved.
I had the same problem and i tried to uninstall/install the android studio but that didn't work out for me.
I had recently installed a fresh copy of windows. I'm using windows 10 64bit.
My problem turned out to be permission for the folder that contained the android studio/sdk.
To solve it, I removed old user permissions for user of old windows and added full control for my new user(not sure but i think modify permission would be enough).
To do so, I right click on the folder then selected the security tab.
Then click on Edit
Then click Add in the new screen
my user is named hany so i wrote hany then clicked on Check Names and it choose the right one.Click Ok
the user appears as Users (DESKTOP-8FKNNEM\Users) and then i check the Full control Then Ok
If the user had already existed in the Security tab then it should have permissions that would enable writing
I had this problem before and I tried to uninstall android studio and tried everything but I found the solution..
the solution is :
Download SDK from beginning , and change the SDK path to the new one, then it all will work .. good luck
delete
sdk-root\sources\android-##\.installer\.installData
and
sdk-root\platforms\android-##\.installer\.installData
My solution: (not as complicated as it looks)
Close project and exit Android Studio.
Run Android Studio as Administrator. (Right click on Android's icon will do.)
Android automatically loads a previous project, at exactly where I have left it supposedly.
However, it isn't where I have left it. It is at an earlier project where things (sdk settings/locations) have NOT gone wrong.
Next thing, I open the project I want to work on. A dialogue box appears saying that the Project SDK and Android SDK are pointing to different local folders. Two buttons allow me to choose which SDK location I want to use.
Either one should work!!!
Reflection:
It happens when we switch to a different user but tried to work on the same project.
We should remember to run Android Studio as Administrator unless we have an absolute clear mind about how SDK works.
Make sure you don't have an emulator running when you perform the sdk update. That was my problem that was giving this error.
Check the logs - Menu -> help -> show log in files.
In file explorer sort files by modified time.
Go to end at latest updated file you will find some error written there
In my case, it was "No space left on device".
ide.log location
Help -> Show Log in Explorer
Right click android studio and click run as administrator.. it will work.
It happens some times, you have to re-download it from the beginning with all the files because it seems that the download failed at some point, and then retry
Once I also stuck on that when tried to install emulator via AndroidSDK manager.
The solution is simple.
Right click on your Android sdk home and select sort by time.
And see last modified files.
In my case there were two text files. First file in root folder - ".knownPackages" with text something like: "ÈäUuMá–m ™ŒÝ¼´" and another one in".installdata"with endless text "nullnullnull....". But i forgot its location right now. You can search that in windows explorer.
Then I replaced them to a folder not related to Android home. Sdk re-generated them both after emulator installation.And it started work as it was before
Download Intel XAMP by clicking on this link https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager-end-user-license-agreement
After downloading extract this file and install intelhaxm-android.exe file
Problem Solved....
The easiest way I used to fix this issue is to run Android Studio as administrator (Note! My android studio installed on C:/ partition, so this issue caused by permissions)
enter image description here
I found a file ".installData" on the system drive of Windows on advice #dmsherazi. I in this file simply deleted a line in which the path is specified. Then I restarted the Studio and the update fell into place.
solution: install and reinstall Android Studio SDK
or deleting the \instantapps folder in C:\Users\UserName\AppData\Local\Android\Sdk\extras\google\instantapps could be the right solution
Go to "android-sdk" folder. Then go to "ndk-bundle", find and delete ".installData". Come back to Android Studio and goto "Help" and "Check for Updates...". I hope this will work for most of the systems. This problem solved on Android Studio 3.3.2 version.
Make sure that you have the correct access rights to the folder where the sdk is located
If this issue is with Ubuntu please try to start android studio as an administrator privilege by using the command
sudo sh studio.sh
It will resolve this issue.
If you are going for a console command it would be:
chmod -R 777 /www/store. The -R (or --recursive) options make it recursive.
Or if you want to make all the files in the current directory have all permissions type:
chmod -R 777 ./
If you need more info about chmod command see: File permission
First of all you have to show hidden files. then go to this location...
"C:\Users\pc\AppData\Local\Android\Sdk\emulator.installer"
there you will find a file by name ".installData". just delete it.
Come back to Android Studio and goto "Help" and "Check for Updates...". I hope this will work for most of the systems.
Thank me later😎
I had the same problem and I tried to delete sdk-root\.temp directory and it worked for me.
I restarted Android in Administrator mode and it worked for me
Check your internet connection/Change another internet connection and try again.

Error message in Android Studio when trying to run and load emulator for the first time

The error message is:
PANIC: Could not open AVD config file: C:\Users\Darth\.android\avd\Nexus_5_API_21_x86.avd\config.ini
I've looked in that directory and there is no config.ini file. Only a userdata.img file.
When looking in the AVD manager the actions column says "Failed to load". If I right click it and click details it shows an error of:
Error: Failed to parse properties from C:\Users\Username\.android\avd\Nexus_5_API_21_x87.avd\config.ini
Fixes attempted that didn't work:
1 - Try choosing a different device definition. (config.ini file still missing when choosing multiple other devices)
2 - sharing the .android directory with my whole homegroup (selecting a device still doesn't generate a config.ini file, same error persists)
FIX: Thanks for all the replies. The fix that worked was changing the Memory of the AVD to 512!
I also had this same error, but the cause wasn't mis-matched x64 vs x86. Turns out my emulator failed to load because the skin wasn't defined. The way that I fixed it was:
Remove any previous wear emulators that failed
Pick the Model (Round/Square) and Android version(Lollipop, for instance)
On the final screen, click "Show Advanced Settings"
Scroll all the way to the bottom and set the "Custom skin definition" to "AndroidWearSquare" or "AndroidWearRound", which should be at the bottom of the skins list
Then after you're finished it should all just work!
Just put the Android SDK in the same Drive where you have installed the Android Studio 1.0. There is a problem if these drive letters are different. This will definitely work for you.I have solved this last week.
Try to use an AVD Manager from C:\User\<%USERNAME%>\AppData\Local\Android\Sdk\
https://code.google.com/p/android/issues/detail?id=78577#c25
For windows:
1) in the environment variables add a new "system variables"
ANDROID_SDK_HOME=D:\Program Files\android-sdk-windows (select your home directory of android sdk )
2) modify system variables Path, add "%Android_SDK_HOME%\tools;"
I have created many emulators and never touch .android\avd\Nexus_5_API_21_x87.avd\config.ini
you just create an Emulator, try to avoid "warp user Data", chose the appropriate Device and target API, set the SD memory to amount you want, and do the same with external RAM,and there is no reason to not work.
guesses: may the \Nexus_5_API_21_x87.avd\config.ini is read only! or you don't have permission to access .android/ (share this folder to all users,and give them full acsess.
I hope this will help
As I mentioned above I was facing the same issue.
For me it looks like the bug of the build and definitely not the issue rights, while another file was perfectly created (userdata.img) as well as the whole folder for the avd.
Solution #1: without changing anything in installation, I just found config.ini file in the internet. For example here is the config.ini for Nexus_S_API_21
So then I created Nexus_S AVD and put the config file in the folder. Then it starts working.
The issue with this method:
limited devices
config updates manually through config file
I still had some issues, e.g. instead of displaying the project I was displayed with the home page of Android, and there was no my app
Solution #2: Then I totally removed the Android Studio and cleaned all the stuff and downloaded 0.8.14 from scratch, during installation I updated it once to v.0.9.9. and then didn't update further.
In this version - everything worked just fine without any manipulation. AVD created from the first time and when launched - the project screen is displayed opened with Hello World.
I had the same issue and I was able to fix it with the below solution.
Root Cause: My system is 32-bit and the config.ini file was present in
C:\Users\Saajan Pruthi\.android\avd\Nexus_5_API_21_x86.avd
instead of
C:\Users\Saajan Pruthi\.android\avd\Nexus_5_API_21.avd
Note the x86... I simply copied the config file into the later folder and it worked.
I had the same issue inside Linux. The problem was that made install with root and executed the Android Studio from mi normal user, so in the momment that I install Android Studio every files android for emule stay here:
/root/.android/avd/Nexus_5_API_21_x86.avd
/root/.android/avd/Nexus_5_API_21_x86.ini
So you need do copy the files at your user, then:
sudo cp -Rf /root/.android /home/YOUR_USER
I hope that be help. Regards.
I did the following and it worked:
moved the sdk folder from C:\Users\User\AppData\Local\Android\sdk to the Android Studio program folder under C:\Program Files\Android\Android Studio\sdk
Restarted Android studio and reconfigured it to point to the new sdk folder
Recreated the emulator and started it
I had this problem as well. I just removed the AVD and added it back again - emulator is running fine now.
I had the same problem, and it turned out that my hard drive was full. For anyone still looking for a solution, definitely make sure you still have space.

Updating Android SDK: "A folder failed to be moved."

While trying to update my Android SDK I am encountering this error when trying to install this particular package:
How do I fix this?
This happens once in a while on my Windows SDK (even when I don't have any antivirus or similar programs running, execute the SDK-Manager as an administrator and so on).
I just update the tools by hand in this case. Which means close the SDK-Manager after the error and open the ANDROID_SDK\temp folder. There should be a zip named tools_R16.zip or similar (don't remember the exact name). Unzip that. You should end up with a tools folder. Copy all the files from this folder into ANDROID_SDK\tools. Overwrite when asked. And take a backup of the SDKs tools folder beforehand, just in case something explodes.
After that, start the SDK-Manager again. The tools version should be updated.
The problem seems to be that Eclipse, or even the SDK Manager itself, locks the folder. Running android.bat from the tools folder should do the trick.
If you launched the SDK Manager from Android Studio then all you need to do is close Android Studio.
I presumed the SDK Manager was a modal dialog that was part of Android Studio - not a separate program.
thanks. this is how I fixed it:
I updated the tools by hand in this case. Which means close the SDK-manager after the error and open the folder android-sdk-windows folder. Using LockHunter, unlock all programs from holding a lock on the android-sdk-windows\tools\ folder. http://lockhunter.com/?ver=&vertype=pro&sm=main_window_64
RENAME the android-sdk-windows\tools folder beforehand to tools_DELETEME
There should be a zip named android-sdk-windows\temp\tools_r19-windows.zip. open that, You should see a tools folder in it. Copy that tools folder to android-sdk-windows\tools
After that, start the SDK-manager again. The tools version should be updated.
When you install tools/softwares use SDK manager. But don't use it when update. Do right click -> Run as administrator on android-sdk-windows\tools\android.bat file for updating tools. Always try to run commands as Administrator specially on Windows Vista/7/8. That'll fix most of permission issues etc...
You probably started the SDK manager from eclipse? I encoutnered the same problem, and fixed it by manually opening the SDK manager from the directy tools.
My solution was to start it from within eclipse - as Administrator.
well i had the same issue on windows 7 ... problem is that during the update it tries to rename the tools folder (inside the SDK folder) and that folder is used by a process "ADB" which is currently running ...
so you cannot do the update smoothly until you stop / kill that process ...
BTW copy pasting the new contents of tools folder from the temp would also work ...
With windows 7, when "failed to install popup" appears kill the process called adb (from task manager ctrl+alt+del) then press "Yes" and stuff is being installed.
I tried running android.bat and got the same error.
What worked for me was using unlocker to unlock the \tools folder.
Ensure you don't have any essential files or folder opened/being used by other applications including explorer.
I've read before, people take a copy of the platform-tools folder and run the update from a different location. This ensures you haven't got open the files it's trying to update.
Could also disable your antivirus for 5 minutes o0o0.
On Windows 7 and probably Vista, run Eclipse as administrator.
My problem was Windows 7 security. I opened up the security on C:\Program Files\Android to EVERYONE with FULL access and it then worked. I then removed EVERYONE after the update was complete.
I had to make a copy of the tools folder itself (keeping it at the same directory tree
level, thus "tools" and "tools-copy" were both in the "android-sdk-windows" folder).
Then ran Android.bat from that copy.
After the update just delete the tools-copy folder.
The error message was Failed to rename directory C:\devtools\android-sdk\system-images\android-21\google_apis\x86 to C:\devtools\android-sdk\temp\SystemImagePackage.old01. I deleted the C:\devtools\android-sdk\temp\SystemImagePackage.old01 directory by hand (it was a leftover? I don't know) and it was able to proceed.
Same error i got while updating sdk. It is because of targeted folder locked (access permission is denied).
You can resolve it as follows in "Ubuntu" :-
Press ALT + F2 and type 'gksudo nautilus' and navigate to the targeted folder like tools or extras and give create and delete permission.
then update, every thing will be working fine :)
First make a copy of tools folder in same directory (android-sdk or android-sdk-windows) then delete the original tools folder and then open the android.bat file by double clicking in tools-copy folder to launch sdk manager and install the tools.
If tools folder is not being deleted then use the unlocker LockHunter to delete the folder and then open android.bat to update the tools.
After successful installation of tools delete the tools-copy folder.
Close Eclipse or Android Studio if open.
It worked for me!!!
On my PC it was caused by monitor.exe running in the background. Terminating that proces solved the problem.
Close the currently launched android studio window from task manager by going to the studioprocess (So when closed there are currently no active studio windows). Then go to Android studio in windows explorer, select the studio64/studio(if 32 bit OS) and right click and select run as administrator.
In one line - you need to run Android Studio as a administrator.
These are the steps followed by me.
Restart the computer.
Open "C:\android\androidStudio\sdk\tools\android.bat" as admin.
Now install packages should run fine.
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.
In Ubuntu following solved issue for me
cd [tools/directory/path]
sudo ./android
Solved this on my side by killing the adb.exe in Task Manager.
I just stopped the emulator, and problem was solved.

Categories

Resources