Related
I have got a problem with Android Studio IDE.
Since the last update, when I am trying to start my app in device, IDE returns an error to me ( Unable to locate ADB ).
I tried reinstall platform tools. It didn't help.
I reinstalled the Android Studio. It didn't help too.
I even reinstalled Windows, but it didn't help too.
I was looking for a solution and I tried fixing it, but it isn't working.
Please help.
1- on your android studio go to Tools > android > SDK Manager.
2- view android SDK location (this will show you your sdk path)
3- navigate to file explorer on your system, and locate the file path, this should be found something like c://Users/xxxx/AppData/local/android (you can now see the sdk.)
4- check the platform tools folder and see if you would see anything like adb.exe (it should be missing probably because it was corrupted and your antivirus or windows defender has quarantined it)
5- delete the platform tools folder
6- go back to android studio and from where you left off navigate to sdk tools (this should be right under android sdk location)
7- uncheck android sdk platform-tools and select ok. (this will uninstall the platform tools from your ide) wait till it is done and then your gradle will sync.
8- after sync is complete, go back and check the box of android sdk platform-tools (this will install a fresh one with new adb.exe) wait till it is done and sync project and then you are good to go.
I hope this saves someone some hours of pain.
unable to connect to adb.check the event log for a possible issue, verify that localhost entry is pointing to 127.0.0.1 or:: 1 for ipv4 or ipv6
Tried adb kill-server, restart, invalidate restart nothing works.
Same issue reported over here https://issuetracker.google.com/issues/130791561
Note: I have not added any file or anything in studio, it's fresh installed Studio after format a full system still issue is there.
Replace your platform-tools with this one and delete the other one.
https://dl.google.com/android/repository/platform-tools_r26.0.0-windows.zip
I was also facing this issue in android Studio 3.4 version, but now I have fixed it , if you are using windows then follow these steps:
Download Platform tools from here
https://dl.google.com/android/repository/platform-tools_r26.0.0-windows.zip
Extract downloaded zip file
Go To location "C:\Users\your_computer_user_name\AppData\Local\Android\Sdk" and Delete "Platform tools" folder
Copy and Paste, downloaded platform tool folder to above location
Now Go to your android studio and Rebuild your project Then run.
For Mac Users, follow these simple steps :
Just simply Navigate to Tools > SDK Manager> Android SDK>, then click on the Tab of SDK Tools, then look for Android SDK Platform-tools and update it.
Then the last step, Invalidate cache and restart your IDE, after that, then finally you restart your Mac. (Sometimes it's this step is unnecessary)
It will work out successfully.
Solution for Linux Users.
System info: Linux Mint Cinnamon 19.1 , Android Studio 3.4.1
Issue description: Problem with platform tools.
Solution: Remove the folder manually and update SDK tools through Android Studio.
Step 1: Go to your Android SDK installation folder. By default under your home directory. Choose platform-tools and simply delete. (/home//Android/SDK)
Step 2: Open Android Studio and go to SDK Tools. (File -> Settings -> Appearance & Behaviour -> System Settings -> Android SDK -> SDK Tools) By the moment you should be able to see Android SDK Platform Tools line unchecked.
Step 3: Put a check to install Platform Tools and press OK. Notice it'll relocate the folder to the directory where deleted.
Now that you re-installed the platform tools, restart the Android Studio and your deployment targets should show up.
If you don't install the platform tool back and ever try to build or run a project you'll get this IDE error. Just FYI :)
So that's all. Enjoy.
Happy coding
If you use Windows, you might have a corruption in api-ms-win-crt-runtime-l1-1-0.dll.
Try to update it - you can get the update from Microsoft's website.
You should check it - path/to/sdk/platform-tools and try to run adb.exe
When you update Sdk platform tools(which contains adb.exe) to release 28.0.2 and if you are using windows 8.1 then it needs few updates from windows.
As per SDK Platform tools release notes(https://developer.android.com/studio/releases/platform-tools):
Updated Windows requirements : The platform tools now depend on the Windows Universal C Runtime, which is usually installed by default via Windows Update. If you see errors mentioning missing DLLs, you may need to manually fetch and install the runtime package."
Windows update url: https://support.microsoft.com/en-ca/help/2999226/update-for-universal-c-runtime-in-windows
Prerequisite for Windows update url: https://www.microsoft.com/en-us/download/details.aspx?id=42327
Faced the exact same issue but after updating with prerequisite url first then the other url provided now it is working perfectly fine for me.
It worked for me by selecting -> Use libusb backend
This worked for me on Windows:
Goto cmd write %temp% hit enter -> delete all data from there.
Restart your Computer.
Open Android Studio now, it will work.
Clear all cache memory (related to Android Studio)
Restart ADB manually from Android Studio (first option)
Open Command prompt and got android sdk>platform-tools> adb kill-server
press enter
and again adb start-server
press enter
Restart ADB manually form Android Stidio (second option)
go to your (SDK store path) sdk>platform-tools>adb
press enter
ex. D drive > sdk>platform-tools>adb
Restart your system
Delete the platform-tools folder from the sdk and replacing with the same from your another pc. I am also facing this problem after updating to 3.4. If you face same problem please update to Android Studio 3.5 Canary Channel.
The reason is for ADB server problem. Simply re-run your adb.
(Go to your SDK folder then inside platform-tools folder you can see adb.exe. copy the path location and paste it in your computers system Environment variable. Set a new path there and paste the adb.exe file location there. hope it will solve )
If you are using Genymotion, there is an update that fix the problem.
Genymotion 3.0.2 (April 18th, 2019)
Corrections
We have fixed an
incompatibility with the adb tool bundled in the platform-tools 28.0.2
package of the Android SDK, which caused failures to start virtual
devices.
This new version of adb changed the behavior of the “adb connect
:” command by making the “port” part mandatory. This
broke Genymotion Desktop in a few places where it did not pass the
port. We have adjusted the way we call “adb connect” and also updated
the version we ship with the product to match the one in
platform-tools 28.0.2.
If non of the above answers worked for you (as same happend to me), down grade to the old version of Android Studio by following these steps:
Uninstall current Android Studio
Go to Android Studio Archive and download any older version
After installation, Open the project. You might see an error like this
This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer.
Now, open project gradle and update classpath tools.build version. I.e. in my case Android studio version is 3.2 and classpath 3.2.1
Hope it might save someone time.
I faced this issue last night, and I tried these methods to fix:
download older platform-tools and place it in the android sdk folder.(not work for me)
adb kill-server, adb start-server.(not work for me, adb had no response with these cmd)
kill the process that occupies port 5037.(for me, there is no other .exe run at this port)
reinstall platform-tools in Android Studio.(not work)
download ADB Kits and replace them in platform-tools folder.(work!!!)
It seems that my adb file has been modified or replaced by some programs. You can try these methods, and I hope some of them can work for you.
I had this issue only after a Genymotion update, on Mac.
What worked for me: Open Genymotion preferences, Select ADB, choose "Use custom Android SDK tools" and points to your Android SDK folder.
Actually the problem is not with the android studio version 3.4
Problem is with the android platform tools version which is latest one 29.
So install the previous version of the android platform tools version it will solve your problem. as above #Ved mentioned.
Ved link:
https://dl.google.com/android/repository/platform-tools_r26.0.0-windows.zip
EndTask adb.exe from Background processes (TaskManager) and Run Application again.
It works for me
Not sure what I'm doing wrong here. I installed the Android SDK Manager, and am now trying to install a platform like the Android Dev website suggests. Once I clicked install I got an error stating that the Manager could not create a temp folder within the Android directory. So I created it. Now I'm getting this error:
Downloading SDK Platform Android 2.3,
API 9, revision 1 File not found:
C:\Program Files
(x86)\Android\android-sdk-windows\temp\android-2.3_r01-linux.zip
(Access is denied)
There is also a little message under the progress bar that says "Done. Nothing was installed."
I'm running Windows 7 Ultimate, in case that's of any use.
Try running Android Studio as an administrator, by right-clicking on the .exe and selecting "Run As Administrator".
Also, some anti-virus programs have been known to interfere with SDK Manager.
I was getting a similar permission issue and SDK Manager could not download and install new components. Error message was (I'm running Android Studio (I/O Preview) 0.2.9)
"Unable to create C:\Program Files
(x86)\Android\android-studio\sdk\temp"
Although solution was infact what #william-tate's answer says, I could not run the 'SDK Manager' directly. It fails with message:
Failed to execute tools\android.bat
The system cannot find the file specified.
Instead I ran the 'tools\android.bat' as Administrator, which in turn launched SDK Manager with same permissions which fixed the issue.
Hope this helps for someone who faces the issue I faced.
In Mac OS X (tried with Android Studio), do the following in Terminal
cd /android/adt-bundle-mac-x86_64/sdk/tools
sudo ./android sdk
This launches SDK manager as admin. Now update/install the packages from SDK manager and it'll work.
For Android Studio, selecting "Run As Administrator" while starting Android Studio helps.
In my case I had to specify proxy settings in Tools->Options.
I had same problem when I try to install it on my pc (Win7, 64-bit system). I had an error message shown in figure below. But when I check my local folder 'C:\Users\username\AppData\Local\Android\sdk', the Android SDK is already there. Somehow Android studio could not see/link it.
So please check first whether you can find the Android SDK in the local folder. If yes, just follow the next steps.
Chose 'Cancel' and click on 'X' on the top right corner.
Chose 'Do not re-run the setup wizard' and click 'OK'
Start Android Studio again and go 'Configure'-->'Project Defaults' --> 'Project Structure'
Add 'C:\Users\username\AppData\Local\Android\sdk' to 'Android Location' and click 'OK'
Click on 'Start a new Android Studio project'.
Hopefully it helps.
I had a similar issue - very slow xml downloads followed by an empty package list. The SDK, it seems, was trying to use legacy Java installation. Setting the JAVA_HOME to the 1.6 jdk did the trick.
In my case I was using Windows 7 with the 64-bit OS. We installed the 64-bit Java SE and 64-bit ADT Bundle. With that set up, we couldn't get the SDK manager to work correctly (specifically, no downloads allowed and it didn't show all the API download options). After trying all of the above answers and from other posts, we decided to look into the Java set up and realized it might the 64-bit configuration that's giving the ADT bundle grief (I vaguely recall seeing/reading this issue before).
So we uninstalled Java 64-bit and reinstalled the 32-bit, and then used the 32-bit ADT bundle, and it worked correctly. The system user was already an admin, so we didn't need to "Run as Administrator"
For those running SDK Manager in Eclipse, selecting "Run As Administrator" while starting Eclipse.exe helps.
For Linux/ubuntu User
Why it's happening?
due to lock icon on some folder(not having read/write access) in
"/yourpath/android-studio-SDK"
Sort and sweet solution
-Open Terminal (Ctrl +alt +t)
-copy pest sudo chown -R $USER: $HOME
-wait for a while.....
-now Try again to update your SDK
Happy Coding :)
The Access denied is because Windows doesn't give the default write and modify permission to the files in its install drive viz. c:
To resolve this issue I usually use a separate drive or in your case, you need to set the access rights to the specific folder in the options
right click -> options > security -> edit
In windows 8:
right click on windows button
List item
CDM as administrator
Press 'yes'
paste this $ C:\xxx\xxx\AppData\Local\Android\sdk\tools\android.bat
If you use SDK Manager in Eclipse:
Option 1: Right-click on eclipse.exe and select "Run As Administrator".
Option 2: If you don't want to start Eclipse.exe as Administrator just install/copy Eclipse installation files from "C:\program files\Eclipse ADT Bundle\" to some unprotected folder, like "D:\android\". Run "D:\android\eclipse\eclipse.exe", select menu item "Window => Preferences => Android" and change "SDK Location" to "D:\android\sdk\". After that you'll be able to install new packages in Android SDK Manager.
go to sdk folder and right click on SDK manager and run with administrator and enjoy installing.
To go along with what v01d said:
Using Android Studio for Mac OS X, the SDK folder could also be at /Users/{user}/Library/Android/sdk, where {user} is your username.
To find out where the partial SDK installation is, go to Configure > SDK Manager in Android Studio, then click edit at the top. This should pop up a window and show the location.
Copy this path and paste it front of the cd command in a terminal. Finally execute sudo ./android sdk to launch the standalone SDK manager.
EDIT (July 14, 2016):
The "android" binary file could also be at /Users/{user}/Library/Android/sdk/tools.
Solution for macOS
click right on AndroidStudio.app -> show Package Contents -> MacOS
now drag & dropping the studio-executable in a terminal
sudo! (Ctrl+A places your cursor in front)
start the SDK Manager inside AS to get your stuff (you will have root access)
https://www.youtube.com/watch?v=ZPnu3Nrd1u0&feature=youtu.be
you need 3 steps:
1- Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy. I selected
"Automatic proxy configuration url:"
2-Delete your ~/.Android* folders (c:\users\ur user).
3-Run Android Studio. It will show you a welcome wizard where it tries to download the SDK again.
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.
Not sure what I'm doing wrong here. I installed the Android SDK Manager, and am now trying to install a platform like the Android Dev website suggests. Once I clicked install I got an error stating that the Manager could not create a temp folder within the Android directory. So I created it. Now I'm getting this error:
Downloading SDK Platform Android 2.3,
API 9, revision 1 File not found:
C:\Program Files
(x86)\Android\android-sdk-windows\temp\android-2.3_r01-linux.zip
(Access is denied)
There is also a little message under the progress bar that says "Done. Nothing was installed."
I'm running Windows 7 Ultimate, in case that's of any use.
Try running Android Studio as an administrator, by right-clicking on the .exe and selecting "Run As Administrator".
Also, some anti-virus programs have been known to interfere with SDK Manager.
I was getting a similar permission issue and SDK Manager could not download and install new components. Error message was (I'm running Android Studio (I/O Preview) 0.2.9)
"Unable to create C:\Program Files
(x86)\Android\android-studio\sdk\temp"
Although solution was infact what #william-tate's answer says, I could not run the 'SDK Manager' directly. It fails with message:
Failed to execute tools\android.bat
The system cannot find the file specified.
Instead I ran the 'tools\android.bat' as Administrator, which in turn launched SDK Manager with same permissions which fixed the issue.
Hope this helps for someone who faces the issue I faced.
In Mac OS X (tried with Android Studio), do the following in Terminal
cd /android/adt-bundle-mac-x86_64/sdk/tools
sudo ./android sdk
This launches SDK manager as admin. Now update/install the packages from SDK manager and it'll work.
For Android Studio, selecting "Run As Administrator" while starting Android Studio helps.
In my case I had to specify proxy settings in Tools->Options.
I had same problem when I try to install it on my pc (Win7, 64-bit system). I had an error message shown in figure below. But when I check my local folder 'C:\Users\username\AppData\Local\Android\sdk', the Android SDK is already there. Somehow Android studio could not see/link it.
So please check first whether you can find the Android SDK in the local folder. If yes, just follow the next steps.
Chose 'Cancel' and click on 'X' on the top right corner.
Chose 'Do not re-run the setup wizard' and click 'OK'
Start Android Studio again and go 'Configure'-->'Project Defaults' --> 'Project Structure'
Add 'C:\Users\username\AppData\Local\Android\sdk' to 'Android Location' and click 'OK'
Click on 'Start a new Android Studio project'.
Hopefully it helps.
I had a similar issue - very slow xml downloads followed by an empty package list. The SDK, it seems, was trying to use legacy Java installation. Setting the JAVA_HOME to the 1.6 jdk did the trick.
In my case I was using Windows 7 with the 64-bit OS. We installed the 64-bit Java SE and 64-bit ADT Bundle. With that set up, we couldn't get the SDK manager to work correctly (specifically, no downloads allowed and it didn't show all the API download options). After trying all of the above answers and from other posts, we decided to look into the Java set up and realized it might the 64-bit configuration that's giving the ADT bundle grief (I vaguely recall seeing/reading this issue before).
So we uninstalled Java 64-bit and reinstalled the 32-bit, and then used the 32-bit ADT bundle, and it worked correctly. The system user was already an admin, so we didn't need to "Run as Administrator"
For those running SDK Manager in Eclipse, selecting "Run As Administrator" while starting Eclipse.exe helps.
For Linux/ubuntu User
Why it's happening?
due to lock icon on some folder(not having read/write access) in
"/yourpath/android-studio-SDK"
Sort and sweet solution
-Open Terminal (Ctrl +alt +t)
-copy pest sudo chown -R $USER: $HOME
-wait for a while.....
-now Try again to update your SDK
Happy Coding :)
The Access denied is because Windows doesn't give the default write and modify permission to the files in its install drive viz. c:
To resolve this issue I usually use a separate drive or in your case, you need to set the access rights to the specific folder in the options
right click -> options > security -> edit
In windows 8:
right click on windows button
List item
CDM as administrator
Press 'yes'
paste this $ C:\xxx\xxx\AppData\Local\Android\sdk\tools\android.bat
If you use SDK Manager in Eclipse:
Option 1: Right-click on eclipse.exe and select "Run As Administrator".
Option 2: If you don't want to start Eclipse.exe as Administrator just install/copy Eclipse installation files from "C:\program files\Eclipse ADT Bundle\" to some unprotected folder, like "D:\android\". Run "D:\android\eclipse\eclipse.exe", select menu item "Window => Preferences => Android" and change "SDK Location" to "D:\android\sdk\". After that you'll be able to install new packages in Android SDK Manager.
go to sdk folder and right click on SDK manager and run with administrator and enjoy installing.
To go along with what v01d said:
Using Android Studio for Mac OS X, the SDK folder could also be at /Users/{user}/Library/Android/sdk, where {user} is your username.
To find out where the partial SDK installation is, go to Configure > SDK Manager in Android Studio, then click edit at the top. This should pop up a window and show the location.
Copy this path and paste it front of the cd command in a terminal. Finally execute sudo ./android sdk to launch the standalone SDK manager.
EDIT (July 14, 2016):
The "android" binary file could also be at /Users/{user}/Library/Android/sdk/tools.
Solution for macOS
click right on AndroidStudio.app -> show Package Contents -> MacOS
now drag & dropping the studio-executable in a terminal
sudo! (Ctrl+A places your cursor in front)
start the SDK Manager inside AS to get your stuff (you will have root access)
https://www.youtube.com/watch?v=ZPnu3Nrd1u0&feature=youtu.be
you need 3 steps:
1- Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy. I selected
"Automatic proxy configuration url:"
2-Delete your ~/.Android* folders (c:\users\ur user).
3-Run Android Studio. It will show you a welcome wizard where it tries to download the SDK again.