What to do if Android SDK is not found in Android Studio - android-studio

I have installed Android Studio, but its not locating Android SDK, I even tried to change the directory, but in vain.
Please check the photo to see the problem

go to the SDK manager just like in you image, press on edit, you'll get a setup wizard that will download the SDK files for you, if you think it's already been installed try to use the following directory
C:\Users'your_username'\AppData\Local\Android\Sdk
this is where the SDK is usually downloaded to, also note that the appdata folder is hidden in the file explorer

Related

SDK problem after GitHub import to Android Studio

I am new to programming.
I have never coded and I have never used Android Studio and GitHub.
Sorry if I ask stupid questions.
I downloaded this project in ZIP on GitHub: https://github.com/raghavtilak/Paint
When I open it in Android Studio, I get an error message:
"The SDK path 'C:\Sdk\Sdk' does not belong to a directory.
Android Studio will use this Android SDK instead : 'C:\Users\jane\AppData\Local\Android\Sdk' and will modify the projectct's local."
What should I do to solve this problem?
Thank you in advance.
When you open the project in Android Studio it should ask you to change the SDK path automatically. If it does you can just accept it and it will change the path without you noticing and without any problems.
If it does not ask you, just search your SDK Path (on your computer) and change it in your local.properties in the project panel (or the windows explorer) in android studio.

"Unable to locate adb" popping up in Android Studio [duplicate]

This question already has answers here:
Error:Unable to locate adb within SDK in Android Studio
(31 answers)
Closed 4 years ago.
I have been trying to test my app on real device. I keep receiving error message that "unable to locate adb". I have the USB driver for my phone installed. Thank you for the help. The snap shot is shown below.
on your android studio at the top right corner beside the search icon you can find the SDK Manager.
view android SDK location (this will show you your sdk path)
navigate to file explorer on your system, and locate the file path, this should be found something like
Windows=> c://Users/johndoe/AppData/local/android (you can now see the sdk.)
Mac=>/Users/johndoe/Library/Android/sdk
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)
close Android Studio, open the Task Manager and finish the ADB.exe process if it's running and then delete the platform tools folder
go back to android studio and from where you left off navigate to sdk tools (this should be right under android sdk location)
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.
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.
If you are still having problems, you may need to set the Project SDK.
I hope this saves someone some hours of pain.
if using avast go for virus chest,will find adb,restore it by clicking right button..thats all,perfectly works
open Studio settings-->System settings --> Android SDK --> select SDK tool tab -->> select "Android SDK platform tool" and install
(I am using Android Studio 3.0.1)
I downloaded "SDK Platform-Tools" from
https://developer.android.com/studio/releases/platform-tools
Copied 'adb.exe' to C:\Users\user\AppData\Local\Android\Sdk\platform-tools.
Then I got no errors when running the app.
I also added C:\Users\user\AppData\Local\Android\Sdk\platform-tools\adb.exe to the exception list of my anti-virus tool
I use android studio in Windows 7 and i have AVG for antivirus. The first time you launch adb, AVG prompts you to add avg.exe in antivirus vault. If you accept, then you android studio dont have access to run adb.exe. So open
avg >> options >> Virus Vault >> Restore (select the adb file)
In Android Studio, Click on 'Tools' on the top tab bar of android studio
Tools >> Android >> SDK Manager >> Launch Standalone Sdk manager
there you can clearly see which platform tool is missing , then just install that and your adb will start working properly.In Image You Can see every thing
Due to some problem my adb.exe, was lost. My space of work suffered an electrical energy interruption, after that, I could not run or compile android programs.
Adb.exe is a file which should be located in your [android directory]/sdk/platform-tools. In my case, the file dissapeared, however the platform-tools was ther. My solution was as follows:
I changed the name directory of [android directory]/sdk/platform-tools towards platform-tools_OLD, in order to hide it for android studio without erase it.
In [android directory]/sdk there is a file SDK Manager.exe, ... I launched it.
A window of "Android SDK Manager" is shown, then, in the Tools folder I chose "Android SDK Platform Tools" and then, Install packages.
Enter to Android Studio
This was well for me
Else this will helps you
The ADB is now located in the Android SDK platform-tools.
Check your [sdk directory]/platform-tools directory and if it does not exist, then open the SDK manager in the Android Studio (a button somewhere in the top menu, android logo with a down arrow), switch to SDK tools tab and and select/install the Android SDK Platform-tools.
Alternatively, you can try the standalone SDK Manager: Open the SDK manager and you should see a "Launch Standalone SDK manager" link somewhere at the bottom of the settings window. Click and open the standalone SDK manager, then install/update the
"Tools > Android SDK platform tools".
If the above does not solve the problem, try reinstalling the tools: open the "Standalone SDK manager" and uninstall the Android SDK platform-tools, delete the [your sdk directory]/platform-tools directory completely and install it again using the SDK manager.
Hope this helps!
I had the same problem, and I solved it by doing:
(You should be connected to the internet)
click the logo of the SDK Manager
click Launch StandAlone SDK Manager (wait a moment)
if the dialog of the SDK manager shows, you click cexbox [Tools] and Install all packages
if the download is finished, you restart android studio and boot again..
After that, it should work.
Got it to work go to the local.properties file under your build.gradle files to find out the PATH to your SDK, from the SDK location go into the platform-tools folder and look and see if you have adb.exe. If not go to http://adbshell.com/downloads and download ADB KITS. Copy the zip folder's contents into the platform-tools folder and re-make your project.
I didn't need to update the PATH in the Extended Controls Settings section on the emulator, I left Use detected ADB location settings on. Hope this makes this faster for you !
I fixed this issue by deleting and inserting new platform-tools folder inside android sdk folder.
But it is caused by my Avast anti virus software. Where I can found my adb.exe in Avast chest. You can also solve by restoring it from Avast chest.
If you are using Anti-Virus, you can first check virus chest and restore from there. Otherwise, just go to your SDK Manager and install Android SDK Tools.
Check your [sdk directory]/platform-tools directory and if it does not exist, then open the SDK manager in the Android Studio (a button somewhere in the top menu, android logo with a down arrow), switch to SDK tools tab and and select/install the Android SDK Platform-tools.
Alternatively, you can try the standalone SDK Manager: Open the SDK manager and you should see a "Launch Standalone SDK manager" link somewhere at the bottom of the settings window. Click and open the standalone SDK manager, then install/update the
"Tools > Android SDK platform tools".
If the above does not solve the problem, try reinstalling the tools: open the "Standalone SDK manager" and uninstall the Android SDK platform-tools, delete the [your sdk directory]/platform-tools directory completely and install it again using the SDK manager.
Hope this helps!

Android Studio SDK Issue

I was installed new version of Android Studio but its not show the SDK .Any one help to solve this path issue.See this images.
Android studio configure that not show the SDk where i fix it path of sdk[enter image description here]1
Generally the stored path of android sdk in generally hidden.
So as per my experiences go as i say,
First allow your Pc to show hidden file.
Go to the following directory of your Pc or Lappy:
C:\Users\user\AppData\Local\Android
Here You can see your Sdks.
Open Android Studio
Press CTRL+ALT+SHIFT
In search bar type "sdk" .(Beside it you will see the android sdk location.Change it.)
Set the path of android sdk which you went into earlier in your lappy's directory shown above.
http://filehippo.com/download_android_sdk/download/dd03cc329af0cd74b0e34afce1b4888e/
Here's the link..
And I ain't on Skype. Sorry😔
Thanks to all who give me suggestion.
Now its fix to reinstall complete android studio.
jdk file croup t or missing that why its show many problem.
I copy sdk file in another place and paste again when i reinstall my android studio its fix:) and no need to be download again sdk packages.

Android Studio 1.0.2 laout-land folder now showing

Using Android Studio 1.0.2 (Windows).
How to make a res/layout-land folder?
I try, it seems to work (no error messages), but the folder does not show up in Android Studio.
However, the folder does exist in the file system.
I have some old project (converted from Android Studio 0.9.x): They seem to work better.
I had the same problem. You have to change your structure explorer from Android(I think its default) to Project. You will see the layout-land folder under res.
You can change the structure explorer in Android Studio from Android to Packages:
g
Also after restarting the Android Studio application I was able to see the land folder.

Android Studio quick documentation always "fetching documentation"

I just moved to Android Studio from Eclipse, and I found that it always shows "fetching documentation" when I use quick documentation (Ctrl+Q).
How can I solve this problem?
I downloaded the documentation for API 19, and the problem persists.
The problem is Android Studio does not automatically update the source link of reference even when the documentation is already downloaded.
The default link in jdk.table.xml is http://developer.android.com/reference/ (android studio tries to connect to this online server even if the network is blocked).
To solve the problem, we can just redirect the reference to local source.
MacOS
On MacOS, the config file jdk.table.xml is under
~/Library/Preferences/AndroidStudio<version>/options/, and the docs are here:
~/Library/Android/sdk/docs/, or the custom path of your Android SDK.
In jdk.table.xml, find all the lines:
<root type="simple" url="http://developer.android.com/reference/">
and modify them to
<root type="simple" url="file://$USER_HOME$/Library/Android/sdk/docs/reference/">
Windows
On Windows, the file jdk.table.xml is under
C:\Users\Name\.AndroidStudio<version>\config\options
In AndroidStudio 3.3, modify to
<root type="simple" url="file://$USER_HOME$/AppData/Local/Android/sdk/docs/reference" />
Android Studio (any os)
Then, in File -> Invalidate Caches / Restart… select Invalidate, and retry using Quick Documentation. It should display instantly. If it doesn't, select Invalidate and Restart, and you should be good to go.
Update:
On the newest Android Studio versions you can do as following:
Navigate to Tools > SDK Manager
Select the SDK Platforms tab
Make sure the Show Package Details checkbox, at the bottom right, is checked.
Select your target API level from the list, check the Sources for Android [API_Level] and click apply.
For older Android Studio versions:
Go to: Tools > Android > SDK Manager. Select SDK Tools tab and:
if Documentation for Android SDK is unchecked, check it and click apply
If Documentation for Android SDK is checked, uncheck it and click apply. After uninstall completes check it again and click apply.
UPDATE: out-of-date, please check #Htea's answer.
I was having the same issue as you. Here's what fixed it for me:
Make sure you have the Documentation package downloaded in SDK Manager.
Exit Studio if it's running.
Delete the file named "jdk.table.xml" located in ~/.AndroidStudioX.Y/config/options/ (remember to take a backup first!).
Relaunch Android Studio. should work correctly now and it should regenerate the file automatically.
Note:
This worked for me on Ubuntu 14.04 & Android Studio 0.8.11 (EDIT: Several users are reporting this solution also works for newer versions of Android Studio).
If it still doesn't work, try deleting and re-downloading the Documentation package from inside Android SDK Manager then try the above steps.
If you're running Windows, the file is located at "%UserProfile%.AndroidStudio\config\options", and if you're running OS X, it's located at "~/Library/Preferences/AndroidStudio/options" (credits to #Gero and #Alex Lipov).
Hope it helps.
The reason for me was that I had not downloaded sources for my SDK version defined by compileSdkVersion property in the build file (now called compileSdk in AGP 7.0.0).
So, in Android Studio 4.0 and higher do this:
Go to Settings 🡲 Android SDK 🡲 SDK Platforms tab 🡲 select Show Package Details checkbox at the bottom 🡲 under your target API Android section check the Sources for Android xx 🡲 click Ok and wait for the download to finish.
Thanks to Cyn45 for their answer.
As other answers said, it's because the Android Studio is trying to fetch the javadoc online (from http://developer.android.com/reference/), which will be very slow if the network not good, especially in China because google is blocked. So we should change this setting and let Android Studio fetch javadoc locally:
Download Android SDK Documentation using the Android SDK Manager.
Open the file ~/Library/Preferences/AndroidStudio2.2/options/jdk.table.xml, see notes below to make sure the correct file is edited.
In the file jdk.table.xml, replace all http://developer.android.com/reference/ to the path to your sdk reference folder. For example file://$USER_HOME$/tools/adt-bundle-mac/sdk/docs/reference on my Mac.
On OS X, if you have used several versions of Android Studio, there may be several configuration folders for each version (under ~/Library/Preferences/), you should change the jdk.table.xml in the right folder, in my case I should edit jdk.table.xml under the folder AndroidStudio2.2.
On Windows
File location of jdk.table.xml
C:\Users\[your windows user name]\.AndroidStudio2.3\config\options\jdk.table.xml
Notes
"." before AndroidStudio directory
version number after ".AndroidStudio". Be sure to edit the version number of Android Studio you're currently using. Previous versions will still have directories here as well.
Line to edit
Before
<root type="simple" url="http://developer.android.com/reference/" />
After
<root type="simple" url="file://C:/Android/sdk/docs/reference" />
Notes
C:/Android/sdk/docs/reference replace with Android SDK location on your machine
if you're copy/pasting location from File Explorer, replace backslashes (\) with forward slashes (/)
Each installed Android SDK version will have its own docs XML entry
Edit the line above in each SDK version found in jdk.table.xml (if you want quick docs when targeting those versions in build.gradle). e.g. If you have Android SDK API 25 installed, you'd find a section to edit under <name value="Android API 25 Platform" />
Invalidate Caches / Restart after change!
File -> Invalidate Caches / Restart...
I also found this issue with Android studio 0.8.9 & 0.8.14, here's a simple solution:
File -> Invalid Caches/Restart -> Invalidate and Restart
Sometimes the documentation package may be missing or not up-to-date.
Try open the Android SDK manager(Tool->Android->SDK Manager) and install the 'Documentation for Android SDK' in the latest release, for now it's Android 5.0(API 21), then restart Android studio.
If this happens again, just invalidate the caches.
For android studio 3.4, all you need to do is go to sdk manager -> SDK Tools, check "Documentation for Android SDK" and click apply.
It will automatically update the jdk.table.xml to point to the source you have downloaded.
I found a solution.
Close the android studio and delete the c:\Users\xxx.AndroidStudioBeta\ (in my case)
Change the android sdk path name
Open the android studio, it will ask for the sdk path
Now you can change back the sdk path or using the new sdk path.
You will find Ctrl+Q will work fine. (Don't import old setting)
I think we need download the sdk document before set the sdk path to Android studio. But the Android studio should handle this case or give us a option to set it.
For a quick workaround edit /etc/hosts (or C:\Windows\System32\Drivers\etc\hosts) file and add the line:
0.0.0.0 developer.android.com
This will prevent it but you can comment it out when you need to fetch the latest or ones not cached or read the docs online.
UPDATE: From unknown exactly version, just simply download Android Documentation in SDK Manager could fix the problem. My 3.4.1 do so.
But I don't know whether older version could works as well or not.
I meet the same issue too,but I solved it just now. I used the Android Studio with SDK before I solved it,and then I download a Android Studio Zip without SDK,and run it,and the issue disappeared.
You can try it.
you can disable it, in Android Studio Preference
Android Studio -> Preference -> Editor -> General -> Code Completion -> Show the documentation pupup in XX ms
see my another answer Link

Resources