sdkmanager vs "android update sdk" to install dependencies - android

Im installing android sdk into my ubuntu server to build/test my projects
there.
I need to install dependencies for the command line and I found that now you can only download android/tools folder from Android download link.
There you can find bin/sdkmanager so I used to install build-tools and platform-tools, but found that I can use it to install android sdk versions, support repository, and others.
Whats the difference between
android update sdk --no-ui --all --filter android-25
and
sdkmanager "platforms;android-25"
?

There is no difference between two.
Btw there is a little type in your sdmanager command, platforms;android-25 should be in quotes.
sdkmanager "platforms;android-25"

Right now it looks like the same thing. But
sdkmanager "platforms;android-25"
looks better for me.
Also you can use
sdkmanager --update
to update all installed items without any additional options.

Related

Install Android NDK on Jenkins

I wanted to install the Android NDK on my Jenkins. What I normally do to install components is execute the command
android list sdk --all
and
android update sdk -u -a -t <package number>
Unfortunately android list sdk --all is not showing the NDK, CMake and LLDB sdks that I need.
Why those sdks are not showing on the sdks list?
How can I install the NDK on my Jenkins?
Thanks for the help
Instead of using the command line, you can simply download the NDK per your machine and unzip it to a directory wherever you like. NDK can be downloaded at: https://developer.android.com/ndk/downloads. All the components, e.g. NDK, CMake and LLDB are shipped inside.
Update: If you really want to go for command line approach, command sdkmanager (under directory: <your-path>/sdk/tools/bin) is the way to go.
E.g. List installed and available packages
./sdkmanager --list
To install NDK directly use below.
./sdkmanager "ndk-bundle"
./sdkmanager "lldb;3.1"
./sdkmanager "cmake;3.6.4111459"

The "android" command is deprecated. How to update sdk using terminal

Im using ec2 instance which is Centos 7. Meaning I'm only using terminal not android studio. So I am trying to update my sdk using the command
echo yes | ./android update sdk --all --filter build-tools-26.0.1 --no-ui --force
But it says that:
*************************************************************************
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
*************************************************************************
How do i convert the code above using the sdkmanager command? Thanks!
sdkmanager --update seems to work for me.
<a href>Documentation</a>

How to install android SDK tools without installing Android studio on ubuntu?

I was trying to install Android SDK with the help of the SDK command line tools downloaded from the link https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip on my Linux Ubuntu 16.04 PC.
i run the command following command for installation
./android update sdk
sudo ./android update sdk
but getting the this
error
how to solve this error ?or suggest me a proper way to install build tools.
FYI
and also i read that ~/.android should contain androidtool.cfg file which has below data in it.
http.proxyPort=proper_port
http.proxyHost=Proper_proxy_ip
sdkman.show.update.only=true
sdkman.ask.adb.restart=false
sdkman.force.http=true
It says that android script is deprecated, so you must use $ANDROID_HOME/tools/bin/sdkmanager --update for update all the installed packages, and $ANDROID_HOME/tools/bin/sdkmanager --list for see a list of installed, updates and available packages.
See more options at: https://developer.android.com/studio/command-line/sdkmanager.html or with $ANDROID_HOME/tools/bin/sdkmanager --help
$ANDROID_HOME refer to the location of your Android SDK. by example:
export ANDROID_HOME=$HOME/android/sdk

You have not accepted the license agreements of the following SDK components [duplicate]

This question already has answers here:
Automatically accept all SDK licences
(63 answers)
Closed 5 years ago.
I downloaded the latest Android SDK tools version 24.4.1. I used the command line to install SDKs. I typed y when asked
Do you accept the license 'android-sdk-license-c81a61d9' [y/n]: y
after that install succeeded.
But when using Gradle 3.1 to build, the follows shows up
You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 23, Android SDK Build-Tools 23.0.1].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
I checked ~/.android and /opt/android-sdk where Android tools are put. Neither contain folder named licenses.
The way to accept license agreements from the command line has changed. You can use the SDK manager which is located at: $ANDROID_SDK_ROOT/tools/bin
e.g on linux:
cd ~/Library/Android/sdk/tools/bin/
Run the sdkmanager as follows:
./sdkmanager --licenses
e.g on Windows:
cd /d "%ANDROID_SDK_ROOT%/tools/bin"
Run the sdkmanager as follows:
sdkmanager --licenses
And accept the licenses you did not accept yet (but need to).
For more details see the Android Studio documentation, although the current documentation is missing any description on the --licenses option.
Warning
You might have two Android SDKs on your machine. Make sure to check both ~/Library/Android/sdk and /usr/local/share/android-sdk! If unsure, fully uninstall Android Studio from your machine and start with a clean slate.
Update: ANDROID_HOME is deprecated, ANDROID_SDK_ROOT is now the correct variable
You can install and accept the license of the SDK & tools via 2 ways:
1. Open the Android SDK Manager GUI via command line
Open the Android SDK manager via the command line using:
# Android SDK Tools 25.2.3 and lower - Open the Android SDK GUI via the command line
cd ~/Library/Android/sdk/tools && ./android
# 'Android SDK Tools' 25.2.3 and higher - `sdkmanager` is located in android_sdk/tools/bin/.
cd ~/Library/Android/sdk/tools/bin && ./sdkmanager
View more details on the new sdkmanager.
Select and install the required tools. (your location may be different)
2. Install and accept android license via command line:
Update the packages via command line, you'll be presented with the terms and conditions which you'll need to accept.
- Install or update to the latest version
This will install the latest platform-tools at the time you run it.
# Android SDK Tools 25.2.3 and lower. Install the latest `platform-tools` for android-25
android update sdk --no-ui --all --filter platform-tools,android-25,extra-android-m2repository
# Android SDK Tools 25.2.3 and higher
sdkmanager --update
- Install a specific version (25.0.1, 24.0.1, 23.0.1)
You can also install a specific version like so:
# Build Tools 23.0.1, 24.0.1, 25.0.1
android update sdk --no-ui --all --filter build-tools-25.0.1,android-25,extra-android-m2repository
android update sdk --no-ui --all --filter build-tools-24.0.1,android-24,extra-android-m2repository
android update sdk --no-ui --all --filter build-tools-23.0.1,android-23,extra-android-m2repository
# Alter the versions as required ↑ ↑
# -u --no-ui : Updates from command-line (does not display the GUI)
# -a --all : Includes all packages (such as obsolete and non-dependent ones.)
# -t --filter : A filter that limits the update to the specified types of
# packages in the form of a comma-separated list of
# [platform, system-image, tool, platform-tool, doc, sample,
# source]. This also accepts the identifiers returned by
# 'list sdk --extended'.
# List version and description of other available SDKs and tools
android list sdk --extended
sdkmanager --list
Go to your $ANDROID_HOME/tools/bin
and fire the cmd
./sdkmanager --licenses
Accept All licenses listed there.
After this just go to the licenses folder in sdk and check that it's having these five files:
android-sdk-license, android-googletv-license, android-sdk-preview-license, google-gdk-license, mips-android-sysimage-license
Give a retry and build again, still jenkins giving 'licenses not accepted' then you have to give full permission to your 'sdk' directory and all it's parent directories. Here is the command:
sudo chmod -R 777 /opt/
If you having sdk in /opt/ directory.
I have resolved the problem by using the command:
Go to: C:\Users\ [PC NAME] \AppData\Local\Android\sdk\tools\bin\ (If the folder is not available then download the Android SDK first, or
you can install it from the android studio installation process.)
Shift+Left click and Press W, then Enter to open CMD on the folder path
Type in the cmd: sdkmanager --licenses
Once press enter, you need to accept all the licenses by pressing y
Checking the licenses
Go to: C:\Users\ [PC NAME] \AppData\Local\Android\sdk\
Check the folder named licenses
android-googletv-license
android-sdk-license
android-sdk-preview-license
google-gdk-license
intel-android-extra-license
mips-android-sysimage-license
AS NEW UPDATE FOLDER PATH (Current Android Studio)
Open Android Studio, Tools > Sdk Manager > Android SDK Command-Line Tools (Just Opt-in)
SDKManager will be store in :
Go to C:\Users\ [PC NAME] \AppData\Local\Android\Sdk\cmdline-tools\latest\bin
Type in the cmd: sdkmanager --licenses
Documentation to using the Android SDK: https://developer.android.com/studio/command-line/sdkmanager.html
For Windows users w/o using Andoid Studio:
Go to the location of your sdkmanager.bat file. Per default it is at Android\sdk\tools\bin inside the %LOCALAPPDATA% folder.
Open a terminal window there by typing cmd into the title bar
Type
sdkmanager.bat --licenses
Accept all licenses with 'y'
Update for macOS Sierra 10.12.6 - Android Studio for Mac 2.3.3
Locate the sdkmanager file usually under:
/Users/YOUR_MAC_USER/Library/Android/sdk/tools/bin
./sdkmanager --licenses
Warning: File /Users/mtro.josevaler**strong text**io/.android/repositories.cfg could not be loaded.
6 of 6 SDK package licenses not accepted.
Review licenses that have not been accepted (y/N)? Y
To validate the problem has gone just repeat the operation involved in the license issue.
I solved the problem by opening the Android SDK Manager and installing the SDK build tools for the version it is complaining about (API 24).
I had also updated using the command line previously and I suspect the Android SDK Manager has a more complete way of resolving dependencies, including the license.
Maybe I'm late, but this helped me accept SDK licenses for OSX,
If you have android SDK tools installed, run the following command
~/Library/Android/sdk/tools/bin/sdkmanager --licenses
Accept all licenses by pressing y
Voila! You have accepted SDK licenses and are good to go..
If you want to use the IDE to accept the license, I also found it easy to open up Android Studio and create a new basic project to trigger the license agreements. Once I created a project, the following licensing dialog was presented that I needed to agree to:
I documented fully the information in the following post: Accepting the Android SDK License via Android Studio
I had a similiar problem but ./sdkmanager --licenses didnt work. I follow this thread and "obladors" comment gave me the solution:
https://github.com/oblador/react-native-vector-icons/issues/527
What eventually solved my problem was:
Running ./sdkmanager "build-tools;23.0.1"
Change 23.0.1 with your version
You can accept the license agreement by launching Android Studio, then going to:
Help > Check for Updates...
When you are installing updates, it'll ask you to accept the license agreement. Accept the license agreement and install the updates, and you are all set.
I ran across this error when i ran cordova build android
I solved this issue by firing ./sdkmanager --licenses and accepting all the licenses.
You have a sdkmanager.bat under the android sdk folder in the path: android/sdk/tools/bin
To trigger that open a command prompt in android/sdk/tools/bin
type ./sdkmanager --licenses and enter
Press y to review all licenses and then press y to accept all licenses
In linux
1. Open a terminal
2. Write: "cd $ANDROID_HOME/tools/bin (this path can be /home/your-user/Android/Sdk/tools/bin)"
3. Write: "./sdkmanager --licenses"
4. To accept All licenses listed, write: "y"
5. Ready!
If your are building an app with Ionic Framework, just write again the command to build it.
If you are having this problem for a React Native app, in addition to above mentioned steps, make sure you have the local.properties file in the android directory(AppName/android) of your app which points to your 'sdk' directory:
sdk.dir=/PATH_TO_SDK/
I have resolved the issue by below steps:
update the android sdk with command "tools/android update sdk --no-ui"
got to android sdk folder on jenkins machines, create "licenses" folder
created file named "android-sdk-license" and paste the license from dev machine

How to install Android SDK Build Tools on the command line?

I want to setup the Android dev environment from command line, and encounter the following issue:
wget http://dl.google.com/android/android-sdk_r22.0.5-linux.tgz
after extract the file, run
tools/android update sdk --no-ui
However, it is too slow on running
Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml
The result is that nothing in folder build-tools, and I want is aapt and apkbuilder, since I want to build apk from command line without ant.
By default, the SDK Manager from the command line does not include the build tools in the list. They're in the "obsolete" category. To see all available downloads, use
android list sdk --all
And then to get one of the packages in that list from the command line, use:
android update sdk -u -a -t <package no.>
Where -u stands for --no-ui, -a stands for --all and -t stands for --filter.
If you need to install multiple packages do:
android update sdk -u -a -t 1,2,3,4,..,n
Where 1,2,..,n is the package number listed with the list command above
As mentioned in other answers, you can use the --filter option to limit the installed packages:
android update sdk --filter ...
The other answers don't mention that you can use constant string identifiers instead of indexes (which will change) for the filter options. This is helpful for unattended or scripted installs. Man for --filter option:
... This also accepts the identifiers returned by 'list sdk --extended'.
android list sdk --all --extended :
Packages available for installation or update: 97
----------
id: 1 or "tools"
Type: Tool
Desc: Android SDK Tools, revision 22.6.2
----------
id: 2 or "platform-tools"
Type: PlatformTool
Desc: Android SDK Platform-tools, revision 19.0.1
----------
id: 3 or "build-tools-19.0.3"
Type: BuildTool
Desc: Android SDK Build-tools, revision 19.0.3
Then you can use the string ids as the filter options to precisely specify the versions you want:
android update sdk --filter tools,platform-tools,build-tools-19.0.3 etc
Version 25.2.3 (and higher) of Android SDK Tools package contains new tool - sdkmanager - which simplifies this task of installing build-tools from the command line.
It is located in android_sdk/tools/bin folder.
Usage (from documentation):
List installed and available packages:
sdkmanager --list [options] \
[--channel=channel_id] // Channels: 0 (stable), 1 (beta), 2 (dev), or 3 (canary)
Use the channel option to include a package from a channel up to and including channel_id. For example, specify the canary channel to list packages from all channels.
Install packages:
sdkmanager packages [options]
The packages argument is an SDK-style path, wrapped in quotes (for
example, "build-tools;25.0.0" or "platforms;android-25"). You can
pass multiple package paths, separated with a space, but they must
each be wrapped in their own set of quotes.
Example usage (on my Mac):
alex#mbpro:~/sdk/tools/bin$ ls ../../build-tools/
25.0.0/
alex#mbpro:~/sdk/tools/bin$ ./sdkmanager "build-tools;25.0.2"
done
alex#mbpro:~/sdk/tools/bin$ ls ../../build-tools/
25.0.0/ 25.0.2/
You can also specify various options, for example to force all connections to use HTTP (--no_https), or in order to use proxy server (--proxy_host=address and --proxy_port=port).
To check the available options, use the --help flag. On my machine (Mac), the output is as following:
alex#mbpro:~/sdk/tools/bin$ ./sdkmanager --help
Usage:
sdkmanager [--uninstall] [<common args>] \
[--package_file <package-file>] [<packages>...]
sdkmanager --update [<common args>]
sdkmanager --list [<common args>]
In its first form, installs, or uninstalls, or updates packages.
<package> is a sdk-style path (e.g. "build-tools;23.0.0" or
"platforms;android-23").
<package-file> is a text file where each line is a sdk-style path
of a package to install or uninstall.
Multiple --package_file arguments may be specified in combination
with explicit paths.
In its second form (with --update), currently installed packages are
updated to the latest version.
In its third form, all installed and available packages are printed out.
Common Arguments:
--sdk_root=<sdkRootPath>: Use the specified SDK root instead of the SDK containing this tool
--channel=<channelId>: Include packages in channels up to <channelId>.
Common channels are:
0 (Stable), 1 (Beta), 2 (Dev), and 3 (Canary).
--include_obsolete: With --list, show obsolete packages in the
package listing. With --update, update obsolete
packages as well as non-obsolete.
--no_https: Force all connections to use http rather than https.
--proxy=<http | socks>: Connect via a proxy of the given type.
--proxy_host=<IP or DNS address>: IP or DNS address of the proxy to use.
--proxy_port=<port #>: Proxy port to connect to.
* If the env var REPO_OS_OVERRIDE is set to "windows",
"macosx", or "linux", packages will be downloaded for that OS.
ADB Build-Tools Will Not be downloaded automatically, by command android update sdk --no-ui
So for installing Buil-Tool type (in console):
android list sdk --all
Remember the number that is listed before the item and execute the following:
android update sdk -u --all --filter <number>
commands should be typed in /YourFolder/android-sdk-linux/tools
Also for remote folder (server opened by ssh for example) type:
**./android** list sdk --all
**./android** update sdk -u --all --filter <number>
For simple list of ADB packages type in terminal:
android list sdk
for install all packages:
android update sdk --no-ui
Or with filters (comma is separator):
android update sdk --no-ui --filter 3,5,8,14
A great source of information I came across while trying to install everything Android SDK related from the command line, was this Dockerfile. Inside the Dockerfile you can see that the author executes a single command to install platform tools and build tools without any other interaction. In the case the OP has put forth, the command would be adapted to:
echo y | $ANDROID_HOME/tools/android update sdk --all --filter build-tools-21.1.0 --no-ui
If you have sdkmanager installed (I'm using MAC)
run sdkmanager --list to list available packages.
If you want to install build tools, copy the preferred version from the list of packages available.
To install the preferred version run
sdkmanager "build-tools;27.0.3"
The "android" command is deprecated.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
If you do not need Android Studio, you can download the basic Android command line tools from developer.android.com in section Command line tools only.
from CLI it should be somfing like:
curl --output sdk-tools-linux.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
or
wget --output-document sdk-tools-linux.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
After that just unpack the archive to the target folder
unzip sdk-tools-linux.zip
And now we can install everything you need...
./tools/bin/sdkmanager --install 'build-tools;29.0.2' 'platform-tools' 'platforms;android-29' 'tools'
You can get a complete list of packages using the command ./tools/bin/sdkmanager --list
Some packages require acceptance of the license agreement. you can accept it interactively or just pass "y" to the input stream, like this(two agreements in case):
echo -ne "y\ny" | ./tools/bin/sdkmanager --install 'system-images;android-29;default;x86_64'
And of course, for your convenience, you can export variables such as ANDROID_HOME or ANDROID_SDK_ROOT (including doing it in ~/.profile or ~/.bash_profile) or patch the PATH variable - all this is at your discretion.
Script example:
mkdir /opt/android-sdk
cd /opt/android-sdk
curl --output sdk-tools-linux.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux.zip
echo -ne "y" | ./tools/bin/sdkmanager --install 'build-tools;29.0.2' 'platform-tools' 'platforms;android-29' 'tools'
Requirements:
curl(or wget) and unzip
Troubleshooting:
if you see Warning: Could not create settings, you need to have the tools directory inside the cmdline-tools directory inside the ANDROID_HOME (create it if needed with this exact name) see Android Command line tools sdkmanager always shows: Warning: Could not create settings
I just had a heck of a time getting android sdk dependencies installed via command line and since the documentation that comes with the tools and online are woefully lacking, I thought I'd post what I discovered here.
I'm working with android sdk r24.4.1 for linux. There are two commands that you can run to list the available packages:
android list sdk
and the more exhaustive:
android list sdk --all
The package numbers for specific packages differ for each command above! For example, the former lists package API 23.1 revision 3 as package #3 and the latter lists it as #29.
Now, there are two different ways to install using the android command.
tools/android update sdk --no-ui --filter <package number>
and
tools/android update sdk -u -a -t <package number>
Given that the install commands each can take the package # as a parameter, which package number do you use? After much online searching and trial and error, I discovered that
android update sdk --no-ui --filter uses the package numbers from android list sdk
and
android update sdk -u -a -t uses the package numbers from android list sdk --all
In other words - to install API 23.1 revision 3 you can do either:
android update sdk --no-ui --filter 3
or
android update sdk -u -a -t 29
Crazy, but it works.
Most of the answers seem to ignore the fact that you may need to run the update in a headless environment with no super user rights, which means the script has to answer all the y/n license prompts automatically.
Here's the example that does the trick.
FILTER=tool,platform,android-20,build-tools-20.0.0,android-19,android-19.0.1
( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) \
| android update sdk --no-ui --all \
--filter ${FILTER}
No matter how many prompts you get, all of those will be answered. This while/sleep loop looks like simulation of the yes command, and in fact it is, well almost. The problem with yes is that it floods stdout with 'y' and there is virtually no delay between sending those characters and the version I had to deal with had no timeout option of any kind. It will "pollute" stdout and the script will fail complaining about incorrect input. The solution is to put a delay between sending 'y' to stdout, and that's exactly what while/sleep combo does.
expect is not available by default on some linux distros and I had no way to install it as part of my CI scripts, so had to use the most generic solution and nothing can be more generic than simple bash script, right?
As a matter of fact, I blogged about it (NSBogan), check it out for more details here if you are interested.
However, it is too slow on running
Yes, I've had the same problem. Some of the file downloads are extremely slow (or at least they have been in the last couple of days). If you want to download everything there's not a lot you can do about that.
The result is that nothing in folder build-tools, and I want is aapt and apkbuilder, since I want to build apk from command line without ant.
Did you let it run to completion?
One thing you can do is filter the packages that are being downloaded using the -t switch.
For example:
tools/android update sdk --no-ui -t platform-tool
When I tried this the other day I got version 18.0.0 of the build tools installed. For some reason the latest version 18.0.1 is not included by this filter and the only way to get it was to install everything with the --all switch.
I prefer to put a script that install my dependencies
Something like:
#!/usr/bin/env bash
#
# Install JUST the required dependencies for the project.
# May be used for ci or other team members.
#
for I in android-25 \
build-tools-25.0.2 \
tool \
extra-android-m2repository \
extra-android-support \
extra-google-google_play_services \
extra-google-m2repository;
do echo y | android update sdk --no-ui --all --filter $I ; done
https://github.com/caipivara/android-scripts/blob/master/install-android-dependencies.sh
I just had this problem, so I finally wrote a 1 line bash dirty solution by reading and parsing the list of aviable tools :
tools/android update sdk -u -t $(android list sdk | grep 'Android SDK Build-tools' | sed 's/ *\([0-9]\+\)\-.*/\1/')
Inspired from answers by #i4niac & #Aurélien Lambert, this is what i came up with
csv_update_numbers=$(./android list sdk --all | grep 'Android SDK Build-tools' | grep -v 'Obsolete' | sed 's/\(.*\)\- A.*/\1/'|sed '/^$/d'|sed -e 's/^[ \t]*//'| tr '\n' ',')
csv_update_numbers_without_trailing_comma=${csv_update_numbers%?}
( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) \
| ./android update sdk --all -u -t $csv_update_numbers_without_trailing_comma
Explanation
get a comma separated list of numbers which are the indexes of build tools packages in the result of android list sdk --all command (Ignoring obsolete packages).
keep throwing 'y's at the terminal every few miliseconds to accept the licenses.
Download android SDK from developer.android.com (its currently a 149mb file for windows OS). It is worthy of note that android has removed the sdkmanager GUI but has a command line version of the sdkmanager in the bin folder which is located inside the tools folder.
When inside the bin folder, hold down the shift key, right click, then select open command line here.
Shift+right click >> open command line here.
When the command line opens, type sdkmanager click enter.
Then run type sdkmanager (space), double hyphen (--), type list
sdkmanager --list (this lists all the packages in the SDK manager)
Type sdkmanager (space) then package name, press enter.
Eg. sdkmanager platform-tools (press enter)
It will load licence agreement. With options (y/n). Enter y to accept and it will download the package you specified.
For more reference follow official document here
I hope this helps. :)
Build tools could not be downloaded automatically by default as Nate said in https://stackoverflow.com/a/19416222/1104031 post.
But I wrote small tool that make everything for you
I used "expect" tool as danb in https://stackoverflow.com/a/17863931/1104031 post.
You only need android-sdk and python27, expect.
This script will install all build tools, all sdks and everything you need for automated build:
import subprocess,re,sys
w = subprocess.check_output(["android", "list", "sdk", "--all"])
lines = w.split("\n")
tools = filter(lambda x: "Build-tools" in x, lines)
filters = []
for tool in tools:
m = re.search("^\s+([0-9]+)-", tool)
tool_no = m.group(1)
filters.append(tool_no)
if len(filters) == 0:
raise Exception("Not found build tools")
filters.extend(['extra', 'platform', 'platform-tool', 'tool'])
filter = ",".join(filters)
expect= '''set timeout -1;
spawn android update sdk --no-ui --all --filter %s;
expect {
"Do you accept the license" { exp_send "y\\r" ; exp_continue }
eof
}''' % (filter)
print expect
ret = subprocess.call(["expect", "-c", expect])
sys.exit(ret)
As stated in other responses, the build tools requires the --all flag to be installed. You also better use a -t filter flag to avoid installing ALL the packages but there is no way to filter all the build tools.
There are already features requests for these two points in AOSP bug tracker. Feel free to vote for them, this might make them happen some day:
https://code.google.com/p/android/issues/detail?id=78765
https://code.google.com/p/android/issues/detail?id=58337
I tried this for update all, and it worked!
echo y | $ANDROID_HOME/tools/android update sdk --no-ui
Try
1. List all packages
android list sdk --all
2. Install packages using following command
android update sdk -u -a -t package1, package2, package3 //comma seperated packages obtained using list command
android update sdk
This command will update and install all latest release for SDK Tools, Build Tools,SDK platform tools.
It's Work for me.
To setup android environment without installating the whole android studio :
Download JDK (version greater than 8)
Download gradle from https://gradle.org/install/
Download command line tools from https://developer.android.com/studio scroll down and download command line tools only
Setup the necessary environment variables
Download the necessary SDK tools

Categories

Resources