Google Play Instant Development SDK Update Fails - android-studio

Android Studio 3.2 RC3 keeps asking me to update the Google Play Instant Development SDK (from 1.3.0 to 1.4.0), but it always fails the update with this message:
Failed packages:
- Google Play Instant Development SDK (extras;google;instantapps)
How can I fix this?

Close Android Studio completely
File -> Close.
Delete instantapps Folder form your sdk:
C:\Users\xxx\AppData\Local\Android\Sdk\extras\google\instantapps
update again.
read more http://syscurity.blogspot.com/2018/09/failed-packages-google-play-instant.html

I was able to get this working by:
Closing my project (File -> Close Project)
Open SDK Manager from the gear at the bottom of the window
Click Updates on the left
I had to do this twice and it worked the second time.
If that won't work you can try File -> Invalidate Cache/restart -> Invalidate Restart. Android Studio will close and restart and then updates should install properly.

After delete, you reinstall here "Instant"

find the SDK folder instalation,
go to extra-google-instantaps, delete that
folder instantaps
and after that update again with sdk manager, that
old version is the problem

Solved this (in a similar way to previous, with one exception) by
1: Closing Android Studio File -> Close
2: deleting .installer and tools folders in C:\Users\xxx\AppData\Local\Android\Sdk\extras\google\instantapps
3: Launching SDK Manager from Configure dropdown beside gear icon
Note: I tried deleting the entire instantapps folder but when I did this I did not get presented with the option to
install Instant Development SDK.

Close Android Studio
Go to the SDK installed folder
C:\Users\xxx\AppData\Local\Android\Sdk
or maybe you installed in another drive
Then go to extras\google\instantapps and delete this instant apps folder.
Now open Android Studio
Tools -> SDK Manager -> SDK Tools -> Check the box before
"Google Play Instant Development
SDK"
Click Apply and ok
Enjoy your problem free life.

If your version of Android Studio is 3.2, you can go to C:\Users\xxx and delete the version folder other than <.AndroidStudio3.2>. I did this and it succeeded.

Just needs Administrator privilege to install. Try run Android studio as administrator.

Related

"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!

ADB.exe is obsolete and has serious performance problems

I am using Windows 10 and when I launch the Virtual Device Emulator in Android Studio I keep getting the message which reads:
"The ADB binary at C:\Users\siviw\AppData\Local\Android\Sdk\platform-tools\adb.exe is obsolete and has serious performance problems with the Android Emulator. Please update to a newer version to get significantly faster app / file transfer".
I am a new developer with little experience. What do I need to update to a newer version so that message is no longer shown?
I am new to android as well. dkalev's answer is correct but not very descriptive for a new user. I have outlined the steps below.
Double Shift to open the search box
Type SDK Manager
In the results shown click "SDK Manager"
In the window that opens click the second tab "SDK Tools". You should see that there is an update available for SDK Build-Tools on the first line
Check "Show Package Details" in the lower right hand corner
Scroll to the last (latest version) item under "SDK Build-Tools" and check the box. (Mine was 28.0.1)
Click "Apply"
In the dialogue box that pops up, click "OK"
When the installer finishes, click "Finish"
Uncheck "Show Package Details" and look at "Android SDK Build-Tools" (first line). There should be no update available and it should say "Installed"
Click "OK" to close the SDK Manager
For me, update SDK doesn't help. I solve this problem by unchecking the emulator option "Use detected ADB location". Give it a try.
I had the same problem and solved it by updating the Android SDK Build-Tools. Open the SDK manager in Android studio (double shift and type SDK manager). Then on the second tab (SDK Tools) update the Android SDK Build-Tools and the error message should go away.
This is an years old bug.
Check your adb version like this : (the adb path is given with the error itself)
C:\Users\<your_user_name_>\AppData\Local\Android\Sdk\platform-tools\adb.exe --version
output :
Android Debug Bridge version 1.0.41
Version 29.0.4-5871666
Installed as C:\Users\sunil\AppData\Local\Android\Sdk\platform-tools\adb.exe
It means this adb comes from the latest sdk platform tools 29.0.4.
Check the latest version from official site here.
If you already have the latest version of ADB installed, and still getting the error, this is a known issue. Google hasn't yet provided any other ADB. Click on the "never show again" option and continue.
17-01-2019
This works for me.
Just opened Android SDK Manager Then it showed 4 Updates Available. So I just Updated it and No more above warning.
Had the same issue but in my case the fix was slightly different, as no updates were showing for the Android SDK Tools. I opened the Virtual Device Manager and realised my emulator was running API 27. Checked back in the SDK Manager and I didn't have API 27 SDK Tools installed at all. Installing v 27 resolved the issue for me.
In my case what removed this message was (After updating everything) deleting the emulator and creating a new one.
Manually updating the adb didn't solved this for. Nor updating via the Android studio Gui.
In my case it seems that since the emulator was created with "old" components it keep showing the message. I had three emulators, just deleted them all and created a new one. For my surprise when it started the message was no more.
Cannot tell if performance is better or not. The message just didn't came up. Also I have everything updated to the latest (emulators and sdk).
This happened to me. And, in my case I need Android SDK Platform 29 because I am using react native 0.63 and Android 10 (Q). I had to uninstall Android SDK Platform 28 because it was the one that caused the warning.
I found this video See Here explaining the process.
Open Android Studio then click on configure
Go to SDK Manager
Go to SDK Tools and click show package details
Uncheck Android SDK Platform 28 (OBS: for me) and Apply
Click OK and Finish.
With this I was able eliminate the warning.
I had the same problem and solved it by updating the Android SDK Build-Tools in Android Studio.
step 1 - Double shift and type SDK manager, this will open the SDK manager
step 2 - Then on the second tab (SDK Tools), update the Android SDK Build-Tools and the error message should go away.
if this does not resolve check the option in Setting tab,use detected Adb tool in Setting tab
(You mentioned you are new to Android Studio) so I recommend pressing the Android Studio > Help > Check for updates... button that will update your environment.
I solved this error by uninstalling two older SDK build tools versions, leaving only the most recent one.
The solution that worked for me -
I closed my Android Studio.
I visited this site - https://androidstudio.io/downloads/tools/download-the-latest-version-of-adb.exe.html
From there I downloaded the latest adb.zip file
I unzipped the folder and copied the 3 files -
adb.exe
AdbWinApi.dll
AdbWinUsbApi.dll
I went to the folder - C:\Users\PayelSenapati\AppData\Local\Android\Sdk\platform-tools
There I replaced the old files by the new files. (Paste followed by replace the existing files)
Then I reopened my Android Studio, opened my virtual android device. Everything went fine. The error was no more.
In the SDK Manager, in the SDK Tools tab, check if you have any updates, if not, deselect "Hide Obsolete Packages" and check if you have something marked as (obsolete) if so, deselect the item and apply. In my case, it was the Android SDK Tools.
First you need to check which SDK your Emulator is using and as #kuya suggested you need to follow those steps and install the latest version of that SDK Build Tool. Suppose your Emulator uses SDK 27 then you need to install latest in that series. For me it was 27.0.3. After that the error was gone.
Try factory reset to virtual device from Android Device Manager
None of the top-voted answers worked for me, except when I unchecked "Use detected ADB location" as mentioned above by #褚阳光. Fortunately, in my case though, the message didn't show up, even when I turned it back on. In other words, the problem might be resolved by restarting "Use detected ADB location" :)
Try update your SDK Tools items, and then delete all currently created emulator and recreate again. it works for me
This might sound normal but I was getting the same error but just updated it and it worked now without any error. I suggests anyone to try for updates first.
If you are stuck after following each of the steps outlined in above, I will suggest you combine more than one answers. The answers of #Kuya and #褚阳光 worked for me. Try them out. I can explain more if the steps are yielding results for you.
This can also be an issue with hyper-v settings on Windows 10 pro. Because with this error I was facing BSOD - https://www.techclassy.com/fix-hypervisor-error-bsod/
I faced the same issue, and I tried following things, which didn't work:
Deleting the existing AVD and creating a new one.
Uninstall latest-existing and older versions (if you have) of SDK-Tools and SDK-Build-Tools and installing new ones.
What worked for me was uninstalling and re-installing latest PLATFORM-TOOLS, where adb actually resides.
I got this error and I tried all the possible solutions that I found on every site, nothing worked.
I was working with flutter, and the command flutter doctor showed me that I need to accept a few agreements
I did that and ADB started to work
So conclusion:
If nothing works, install flutter, run flutter doctor, execute the commands that flutter doctor suggests to you. This should solve your problem
the command was: flutter doctor --android-licenses
I followed the answer, but the magic final step was deleting the existing virtual environment and creating a new one.

How to open an existing Flutter Project in Android Studio

I might sound noob here but I can't see a clear way of opening existing Flutter Project in Android Studio 3.1.2.
I checked this but it didn't work. So I want to know if there is a standard IDE way of doing this? I also can't find any docs clearly mentioning it. Do I need to install a 3rd party plugin?
After opening it as an Existing Android Studio Project, I get the following error:
The error is solved by running Get Dependencies. Is it a normal behavior?
Install Flutter plugin for Android studio: https://flutter.io/get-started/editor/
Open Android Studio
Open existing Android Studio project by using one of below methods:
EASIEST WAY: Drag your project folder and drop to Android Studio.
Other ways:
What works for me was to open existing Android Studio project like mentioned above, and then go to menu
Tools -> Flutter -> Flutter Clean
Then configuration window will open and ask you to locate flutter sdk. After locating the sdk, click OK and then the flutter functions will be available (Pub buttons, runs menu). After that you can proceed to get the dependencies (pub get).
It's basically cleaning the project folder of previous setting(s) which might conflicting with the system (android studio). But that won't happen if you get the project from source repository because all of the junk files wont be in the project folder.
The quickest way on macOS is
open -a Android\ Studio android when you are in the root project directory.
Alternatively, if you use the jetbrains toolbox, you can enable "Shell Scripts" in its settings. This will create a binary in the folder of your choice, so you have to add this folder to your PATH. Then, you can use studio . inside the Android folder, or studio android in the flutter project. The benefit of this, is it also works with other Jetbrains products (e.g. charm project_dir or clion project_dir. Unfortunately this method glitches out (for pycharm at least).
Looks like Android Studio can't load Android Application module from Flutter project automatically. I also have same problem, so in my situation Gradle can't be found, because of lack of Android project.
There's important note from official site:
Important: Do not use the New > Project from existing sources option for Flutter projects
I suggest, same is for Open option.
Just Open your project as normal, and then in [Android Studio > Preferences > Languages&Frameworks > Flutter > Flutter SDK path] select the path where you downloaded & unpacked Flutter SDK.
I know it's already late, but you can open an existing Flutter project in Android Studio by following these steps (make sure you have already installed Flutter & Dart plugin and Flutter SDK):
Click Open from File menu in Android Studio,
Go to the path of the project,
Click Open from the dialog,
When the project opens in Android studio, it will show an error of packages and dependencies. So, click on Get Dependencies on the top. Android Studio will automatically add all the required dependencies and packages.
There is a simple way of doing this in android:
Just Open your project as normal, and on the top right corner, click on Flutter Attach option, and voila!
See Attached screen grab!
Usually you can open your Flutter project in Android Studio simply when you right click on the android folder > Flutter > Open Android module in Android Studio but sometimes this option could be disabled, check this answer to enable..

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

Android Studio - How to Change Android SDK Path

When I open Android SDK Manager from Android Studio, the SDK Path displayed is:
\android-studio\sdk
I want to change this path. How do I do it?
From Android Studio 1.0.1
Go to
File -> project Structure into Project Structure
Left -> SDK Location
SDK location select Android SDK location (old version use Press +, add another sdk)
For projects default:
Close current Project (File->Close project)
You'll get a Welcome to Android Studio Dialog. In that:
Click on Configure -> Project Defaults -> Project Structure
Click on SDK Location in the left column
Put the path to the Android SDK in "Android SDK location" field.
(Example SDK location: C:\android-sdk; I have sub-folders like
add-ons, platforms etc under C:\android-sdk)
Click OK to save changes
Have fun!
Following steps were for older versions(<1.0) of Android Studio
In the middle column Click on Android SDK (with Android icon) OR click + on the top if you don't see an entry with Android icon.
Change SDK Home Path and select valid Target.
From the quick start window, choose Configure, then choose Project Defaults, and then choose Project Structure. Then on the left under Platform Settings choose SDKs. Then to the right of that choose the current android platform, mine was Android 4.2.2 Platform, and delete it using the red minus button at the top, then add a new android platform using the green plus button at the top and point it to your current SDK folder and that is it.
I Configured in this way
on
Welcome to Android Studio Screen
Click Configure Then
Project Defaults and then Project Structure
Then
Android SDK and Selected the path to my current location of Android SDK
Changing the sdk location in Project Settings will solve the problem partially. When Android Studio is used to download a new SDK, it will place the new SDK in the internal SDK folder (inside Android Studio).
Existing android developers will already have a large sdks folder (hereinafter referred to as external SDK folder) containing all the SDKs downloaded before Android Studio came around.
For Mac/Linux users though there is a good way out. Soft links!
Exit Android Studio and perform the following steps:
cp -r <Android Studio>/sdk/ <external SDK folder>/
cd <Android Studio>/
mv <Android Studio>/sdk/ mv <Android Studio>/sdk.orig
ln -s <external SDK folder>/ sdk
And we're good to go. Launch SDK Manager after starting Android Studio, watch as it discovers all your existing SDKs like a charm :).
EUREKA I found it!
With the current Studio 1.3 each project has a local.properties file where you can edit the SDK!
Here's how you can change the android sdk path in Android studio:
Open your required android project in Android studio
Click on the main project folder and press F4
Now click on "SDKs" under Platform Settings (Left hand side of the dialog box)
You should now see a plus sign on the top, click it and choose "Android SDK"
Now you would be asked to choose the required SDK folder
Select the required build target(if necessary) and click "ok"
Now you should see the new entry in the list of SDKs
Click "Modules" under Project Settings
Select your project folder and in the Dropdown for "Module SDK", select the new SDK entry and click "apply"
Now click "OK" and your done.
Note: If changes do not take effect, restarting android studio should fix the problem.
Make your life easy with shortcut keys ctrl+shift+alt+S
or
by going to file->project structure:
it will open this window, where you can select your SDK
Try this way i try in Android Studio 2.0
Step 1: File->Settings
Step 2: Settings->SDK options
Step 3: Click Edit option in Sdk Location
Step 4: Show "SDK Components Setup"
Step 5: Click on Three "..." in "SDK Components Wizad"
Step 6: Select your new SDK Path
I noticed that the latest version of Android Studio doesn't seem to have the option "SDKs" path that's mentioned in many of the answers. I'm guessing that disappeared in one of the updates, somewhere down the line?
The way i solved this issue (osx) was:
Go to Project Settings (Cmd + ;)
In SDK Location make sure you're pointing to the correct SDK location (typically /Applications/Android Studio.app/sdk) then hit Apply
Most important step - hit "Sync Project with Gradle files"
I wasn't doing Step 3 and that was throwing me off. After a sync all your source r belong to us....
goto menu File->Project Strucurt or key Ctrl + Alt + Shift + S
and example http://how-to-android-studio.blogspot.com/2014/11/set-sdk-location.html
You can also create the environment variable (in Windows) ANDROID_HOME to the location of the Android SDK and Android Studio will use that.
Above answers are pretty correct, but some times Android Studio, does not like to refresh after SDK path change, a quick solution is to make some change in you Build file, and click on Sync. It will refresh you project.
Happy coding... :)
While first installation There are two situations either you have pre-installed Android SDK if you had used it in past or you have nothing at all, At a time of installation Installer always ask user how you want to configure SDK with your studio.
You can simply give a path here or browse folder where sdk is available in local system. If you already have SDK, Another option as shown in below picture at Left down corner there is a nice option for download SDK, by clicking it you can download SDK with latest release right from there,You can also use third option see in right down corner setup Android SDK for me by clicking it you can step by step set your sdk.
Although you can also set it up when Android shows you list of available projects, a starting prompt window shown below
That's pretty easy, and also sometime if you want to change your SDK you can always change it right in your Android Studio from
On windows system
File --> Project Structure and then you will see SDK Location Option and from there you can set it up by providing a path or by browse it.
Or if you are on MAC system then from Platform settings.
In Android Studio 2.2.3 I think you can change default SDK location for all projects from the top menu:
File -> Project Structure...
A window like below shows up:
in windows press ctrl+shift+alt+s which will open project properties where you can find first option named SDK Location click on it and there you can change SDK path, JDK path and NDK path also
This may not be what you want, but being an eclipse user I had the same problem having duplicate sdk folders which were eating all my ssd space. Currently you can only change sdk path inside android studio project wide which is annoying. What I did instead was I copied all the previous android sdk files that I was using with eclipse to /Android Studio/sdk/ and then just changed the sdk path inside eclipse.
Now both android studio and eclipse are happy.
Here is some ways, as far as I know now.
Android Studio 3.3.2 (testing is OK)
method: 1
just following steps of the official docs, as bellow link shows
https://developer.android.com/studio/intro/studio-config#jdk
method: 2
following steps of the screen shortcuts, as bellow shows
method: 3
following steps of the screen shortcut, as bellow shows
Tap --> file --> close current project.
You'll Android Studio home page
Click on Configure -> Project Defaults -> Project Structure
Click on SDK Location in the left column and copy the path.
Paste the path in My computer --> Right Click -> Properties -> click on Advanced system settings -> Environment variables and change the android home path.
click on 'OK' to save the session.
Add tools and platforms tools in path and save the changes.
Open command prompt[window+R] and type adb + enter.
In Android Studio you can set the general Android SDK path in the file: %Home%.AndroidStudio2.1\config\options\jdk.table.xml
Click on File menu.
Select Project Structure.
Edit the path in SDK Location text box.
From the next time Android Studio will use this location for all your projects.
N.B.: Avoid having spaces in the path as it may sometimes lead to issues.
This is how its done,in Android Studio for windows
Done
For Android Studio 3.1.2:
Tools>> SDK Manager>> Edit "Android SDK Location" to new location
After that, Set environment variable $ANDROID_HOME to your new SDK location
I had the same problem, but with the sdk path pointing to a mounted drive. I found, that simply quit Android Studio, unmount the device and restart Android Studio made it ask for the sdk location, because it had none (Android Studio Beta 0.8.7).
Therefore I guess if you just quit Android Studio, delete \android-studio\sdk or move it somewhere else and start Android Studio again, it should ask for the sdk location aswell.
Though many of the above answers serve the purpose, there is one straight forward thing we can do in project itself.
In Eclipse, go to Window->Preferences, select "Android" from left side menu. On the right panel you will see "SDK Location". Provide the path here.
Good luck.
In Android studio 1.2.2 you can simply changes project based SDK,
Steps:
Right click on Module and select Open module setting or press F12
Select SDK location from left hand side
Now you can change SDK location as well as JDK location from this page
When I ran into trouble with this on Android Studio 3.1.4 the solution was to go into the app dropdown on my project, then Edit Configurations > Defaults > JAR Application where there is a JRE box on the initial Configuration tab. Setting that to my JRE path solved the problem for me.
Simple Answer Work For Sure...
Step 1: Right Click On The Project>> Select Open Module Setting -->
Step 2: Select SDK Location From the Right Side below image
Step 3: Now browse the SDK location from your computer as show below...
Step 4: Click on OK.
I'm guessing from the responses that people aren't understanding your question... If I'm right in that you want to have ~\Desktop\github\ then changing the SDK location isn't what you're after.
From Android Studio 3.2.1:
From the new project dialog, choose
Configure -> Preferences -> Tools -> Terminal -> Start Directory
Put the folder you want as your project default in the field.
e.g. Mine is set to
~/Desktop/github/
since all my work is in
~/Desktop/github/
Just go to
(Main Menu) File > "Sync Project With Gradle Files"
click ok on the popup, it will change your sdk directory.

Resources