Install build tools 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:

Читайте также:  Установленные пакеты linux mint

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. 

Источник

Читайте также:  Get operating system version linux

How to install the Development and build tools on Ubuntu 20.04?

In this very short post, you will learn how to install a series of development and build tools on Ubuntu 20.04. These tools are essential to perform tasks like installing packages from the source code. Or some programming tasks such as package creation.

If you are an application developer and need to package it for a distribution like Debian or Ubuntu, you need some tools. Some of these tools are considered to be essential for the process.

So, all these tools are contained in the word build-essential . Other important packages will be installed there. Some of them are:

  • GCC the GNU C language compiler which is a mainstay for developing various languages and installing programs.
  • make which allows us to compile programs from source code.
  • G++ the GNU compiler for the C++ language which is widely used in QT applications.

Install the Development and build tools on Ubuntu 20.04

Before we start I want to remind you that in this post we will install the basic tools. In case you want to compile a program from the source code, each one of them has dependencies that you have to fulfill.

On the contrary, if you are going to build packages, you also need other more specific ones according to the distribution.

So, open a terminal and install the build-essential package.

:~$ sudo apt install build-essential Reading package lists… Done Building dependency tree Reading state information… Done The following additional packages will be installed: binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 dpkg-dev fakeroot g++ g++-9 gcc gcc-9 gcc-9-base libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev make manpages-dev Suggested packages: binutils-doc cpp-doc gcc-9-locales debian-keyring g++-multilib g++-9-multilib gcc-9-doc gcc-multilib autoconf automake libtool flex bison gdb gcc-doc gcc-9-multilib glibc-doc bzr libstdc++-9-doc make-doc The following NEW packages will be installed: binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-9 dpkg-dev fakeroot g++ g++-9 gcc gcc-9 gcc-9-base libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev make manpages-dev 0 upgraded, 41 newly installed, 0 to remove and 0 not upgraded. Need to get 39.9 MB of archives. After this operation, 175 MB of additional disk space will be used. Do you want to continue? [Y/n]

1.- Installing development and build tools on Ubuntu 20.04

As you can see, this package also installs some necessary dependencies. Don’t worry all these dependencies are more basic package development and build tools.

Some of them may be already installed so you can download the number of packages you need.

When the download and installation is finished, you can check the versions of make, gcc and g++

:~$ make --version GNU Make 4.2.1 Built for x86_64-pc-linux-gnu Copyright (C) 1988-2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
:~$ gcc --version gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
:~$ g++ --version g++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And so these tools have been installed.

Читайте также:  Linux проверить версию python

Conclusion

The development and package building tools are very important in Ubuntu 20.04. Since many programs that are in the repositories depend on them and installing them can save us time.

On the other hand, they become quite necessary if we are developers or application packagers.

So, share this post and join our Telegram Channel.

Источник

Install build essential tools on Ubuntu 22.04 or 20.04 LTS Linux

To compile programs from their source code, we need some tools and libraries available through a single package called on Build essential on Ubuntu 20.04 | 22.04 |18.04 or Debian 11 | 10 base repository. Here we learn how to install it.

Build essential is a name for a package that includes the GCC/g++ compilers and libraries and some other utilities required to compile software written in C and C++.

The Gnu Compiler Collection, GCC for short, is a collection of compilers and offers a uniform interface for creating programs in C, C ++, Objective-C, Fortran, Ada, Assembler and Go.

The original meaning of GCC was GNU C Compiler, but because several other languages ​​have been added since then, the meaning has changed to GNU Compiler Collection. Today the C compiler is called gcc in lower case to make it possible to distinguish it from the whole.

The key packages automatically installed on our Debian or Ubuntu system from Build-essentials are GCC– it is a GNU compile for C Programming; g++ for compiling C++ programming language; libc6-dev – GNU C library; Make – The traditional build system or a tool directs compiler how to work; to pack or unpack a Debian package, utility dpkg-dev is also there.

In short, by setting up build-essential we get all the required tools we need to compile software on Ubuntu/Debian systems.

If you have already created packages of any kind yourself, you will have already installed the build-essential package. In addition to a compiler each for C and C ++, it also contains numerous helpful tools that are so widely used by developers (e.g. Makefiles) that they can be taken for granted under any system that wants to compile something.

This article aims to help compile programs using the GCC on Ubuntu. It does not intend to provide any information programming language.

Источник

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