Android sdk tool linux

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

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.

20 Answers 20

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

And then to get one of the packages in that list from the command line, use:

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

If you are missing build-tools like 18.1.1 then this is the right way to install it using the command line.

@DanielJonker Yes, it is. Just echo «yes» to the command, i.e. echo yes | android update sdk —all —filter tools —no-ui —force > /dev/null

echo «yes» can be shortened to echo «y» , but that doesn’t work in all cases anyway. In some cases you can get more than one y/n license prompt, depending on the filter and specific packages. echo «y» will respond to the first prompt only, but not the rest. I’m trying to make it work with yes command with no success so far.

@AlexanderMalakhov I agree, if your host OS has the utility, using it is the best option. I looked at expect first, but in my case I have to run the script on a certain Linux distributive running in AWS cloud. That distro does not have expect installed and I don’t have enough rights to install it as part of build plan. After looking around, the best solution that I found is

 # update Android SDK on headless server FILTER=tool,platform,android-20 ( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) \ | android update sdk --no-ui --all \ --filter $

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:

Читайте также:  Jabber clients for linux

android update sdk —filter tools,platform-tools,build-tools-19.0.3 etc

android update will also require the —all option, otherwise usage help is displayed. For example: android update sdk —no-ui —all —filter build-tools-21.1.0 (and +1 for the —extended option which allows you to see the aliases like build-tools-21.1.0 )

I was looking for that —extended option so I could write a script and use it in my Continuous Integration Server where it can refresh the sdk resources itself. Nice tip !

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] [] \ [--package_file ] [. ] sdkmanager --update [] sdkmanager --list [] In its first form, installs, or uninstalls, or updates packages. is a sdk-style path (e.g. "build-tools;23.0.0" or "platforms;android-23"). 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=: Use the specified SDK root instead of the SDK containing this tool --channel=: Include packages in channels up to . 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=: Connect via a proxy of the given type. --proxy_host=: IP or DNS address of the proxy to use. --proxy_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. 

Источник

How to install Android SDK on Ubuntu?

For my Ubuntu machine, I downloaded the latest version of Android SDK from this page. After extracting the downloaded .tgz file, I was trying to search for installation instructions and found:

To get started on Linux: Unpack the .zip file you’ve downloaded. The SDK files are download separately to a user-specified directory. Make a note of the name and location of the SDK directory on your system—you will need to refer to the SDK directory later when using the SDK tools from the command line.

there’s an easy install paolorotolo.github.io/android-studio — or check this tutorial on how do it manualy — youtube.com/watch?v=qfinKxwYYZs

Читайте также:  Arch linux packages repository

@Tasos Any idea about the maintenance and long term support paolorotolo’s Android studio? This looks more of a personal project 🙁

Android Studio itself alerts you when there is a new update/upgrade so you do it from there. I dont think the person modified AS

from my last comment — however you can ask that question directly to the person here — github.com/PaoloRotolo/android-studio/issues

9 Answers 9

sudo apt update && sudo apt install android-sdk 

The location of Android SDK on Linux can be any of the following:

  • /home/AccountName/Android/Sdk
  • /usr/lib/android-sdk
  • /Library/Android/sdk/
  • /Users/[USER]/Library/Android/sdk
  • Download the Android Studio.
  • Extract downloaded .zip file. The extracted folder name will read somewhat like android-studio

To keep navigation easy, move this folder to Home directory.

  • After moving, copy the moved folder by right clicking it. This action will place folder’s location to clipboard.
  • Use Ctrl Alt T to open a terminal
  • Go to this folder’s directory using cd /home/(USER NAME)/android-studio/bin/
  • Type this command to make studio.sh executable: chmod +x studio.sh
  • Type ./studio.sh

A pop up will be shown asking for installation settings. In my particular case, it is a fresh install so I’ll go with selecting I do not have a previous version of Studio or I do not want to import my settings.

If you choose to import settings anyway, you may need to close any old project which is opened in order to get a working Android SDK.

From now onwards, setup wizard will guide you.

Android Studio can work with both Open JDK and Oracle’s JDK (recommended). Incase, Open JDK is installed the wizard will recommend installing Oracle Java JDK because some UI and performance issues are reported while using OpenJDK.

The downside with Oracle’s JDK is that it won’t update with the rest of your system like OpenJDK will.

The wizard may also prompt about the input problems with IDEA .

Verify installation settings

An emulator can also be configured as needed.

The wizard will start downloading the necessary SDK tools

The wizard may also show an error about Linux 32 Bit Libraries, which can be solved by using the below command:

sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1

After this, all the required components will be downloaded and installed automatically.

After everything is upto the mark, just click finish

To make a Desktop icon, go to ‘Configure’ and then click ‘Create Desktop Entry’

Источник

How to Install Android SDK without Android Studio on Ubuntu

Android SDK consists of a collection of tools that help developers to create Android applications. It comes with tools such as Build Tools, Platform Tools, Emulator, Jetifier, and command line tools.

Читайте также:  Linux атрибуты всех папок

When you install Android Studio, the Android SDK comes along with it. Some developers may prefer to use their own preferred text editor or IDE and only need SDK tools for their development.

In this tutorial, we learn how to install Android SDK without android studio on a Ubuntu.

Prerequisites

Step 1. Setup Directory for Android SDK

First, create a directory structure to set up SDK Tool. In my case, going to place it in my home directory under ~/android/sdk directory.

For creating the directory, type:

Step 2. Download Android command-line tools

Visit the Android Studio download page and grab the link to download sdk command line tool. This would be at the bottom of the webpage in the section «Command line tools only» and contained in a zip file.

Note: This package is generic for all Linux Distributions. We have tested only on Ubuntu. Should work on other Linux Distros as well.

Android command line tool

Change to the sdk directory created before:

Download the zip file using wget command:

sudo wget https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip

Once downloaded, extract the .zip file using the unzip command:

sudo unzip commandlinetools-linux-9123335_latest.zip

Once extraction is completed, you will have a new directory named cmdline-tools. Now change to that directory.

Let’s create a new directory inside cmdline-tools to hold all bin and lib contents.

Now you can move everything inside the cmdline_tools directory to the tools directory.

Step 3. Let the system know SDK Location

For the SDK command line tool to work, we have to set up environment variables properly. For this let us set the ANDROID_HOME environment variable and update the PATH variable.

export ANDROID_HOME=$HOME/android/sdk export PATH=$ANDROID_HOME/cmdline-tools/tools/bin/:$PATH export PATH=$ANDROID_HOME/emulator/:$PATH export PATH=$ANDROID_HOME/platform-tools/:$PATH

android sdk $Path settings

To make the changes permanent, you would need to add these commands to your shell profile file (e.g. .bash_profile or .bashrc).

Step 4. Install Android SDKs from Command Line

The Android SDK command line tools package comes with sdkmanager command. This tool is used to manage the packages and components of the Android SDK. Commonly used to list, install and update packages.

To list all installed and available packages, type

sdkmanager --list or sdkmanager --list --channel=channel_id // Channels: 0 (stable), 1 (beta), 2 (dev), or 3 (canary)

The output is a long list of packages. You can use filter the list using grep — for example sdkmanager —list | grep package-name.

To install packages use the following syntax:

sdkmanager --install packages [options]

Some of the useful packages are platform tools, build tools, and emulator. To install those packages using sdkmanager, type:

sdkmanager --install "platform-tools" "build-tools;30.0.1" "emulator" "platforms:android-33"

To keep all packages on the latest version update packages use sdkmanager —update command.

Conclusion

In this tutorial, we learned how to install Android SDK without actually installing the full android studio. This is more useful for guys who are more interested to stick on the command line.

Thanks for reading, if you encounter any issues please leave a comment.

If this resource helped you, let us know your care by a Thanks Tweet. Tweet a thanks

Источник

Оцените статью
Adblock
detector