How to install Android SDK on Ubuntu?
Option 1:
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
Option 2:
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 .
Select install type
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'
source
install android sdk using command line linux
It works fine for me. Try it without the --no-ui
flag and see if that works. If not, what is the error message you get?
Edit:
You probably have your PATH
configured incorrectly. You need to execute the "current folder executable" as follows:
$ ./android update sdk --no-ui
How do I update Android SDK in Linux via command line
From the documentation:
Starting with Tools R12, the SDK Manager offers a slightly better way
to update the SDK from command-line.Previously the "
android update sdk --no-ui
" command already allowed
one to update from the command-line, but it had the annoying tendency
of installing every single platform or add-on. There are now 30 or
more packages available on the SDK repository, including 12 platforms;
that's a lot to download when most people only need the most recent
platform. Starting with R12, you can use combine new things:
"
android list sdk
" will connect to the remote repository and list all the
packages available with an index number."
android update sdk --no-ui
"
accepts a "--filter
" argument that can take a package index, or a
category name.
Here's an example in action:
There's still room for improvement, notably in a future release we'll work on the first install case and making the update smarter at figuring out what to get.
How to install Android SDK on Linux using CLI only?
If you use tools/android -h update sdk
(I discovered that by trying tools/android update sdk --help
), you will get a list of options for the update sdk
command, the most interesting one being:
-u --no-ui Updates from command-line (does not display the GUI)
Android Command line tools sdkmanager always shows: Warning: Could not create settings
Instead of passing the argument --sdk_root
for each single command execution, let's deep dive into the real cause.
Starting from Android SDK Command-line Tools 1.0.0 (6200805), in contrast to Android SDK 26.1.1 (4333796), the tools
directory hierarchy has been changed.
Previously it was placed right inside ANDROID_HOME
(which is deprecated, we will use the term ANDROID_SDK_ROOT
for the rest of the paragraph), now it's still named as tools
(the only thing you'll get after unpacking the downloaded commandlinetools zip file), but differently, you have to place it inside a directory called cmdline-tools
on your own. The name cmdline-tools
comes from its package name, where you can get from listing packages command sdkmanager --list
, whose outputs include cmdline-tools;1.0 | 1.0 | Android SDK Command-line Tools
.
Wrapping tools
directory inside cmdline-tools
directory would make it work, and help you get rid of the annoying --sdk_root
argument. But what about the other parts?
Well, that's all you have to change. Let me explain more.
- The king -
sdkmanager
lives insidecmdline-tools/tools/bin
, you'd better set inPATH
environment variable cmdline-tools
should not be set asANDROID_SDK_ROOT
. Because later, when updating Android SDK, or installing more packages, the other packages will be placed underANDROID_SDK_ROOT
, but not undercmdline-tools
.- The final, complete
ANDROID_SDK_ROOT
directory structure should look like below, consist of quite a few sub-directories:build-tools
,cmdline-tools
,emulator
,licenses
,patcher
,platform-tools
,platforms
,system-images
. You can easily point out thatbuild-tools
andcmdline-tools
are siblings, all sit inside the parentANDROID_SDK_ROOT
.
Let me recap in a simple way:
- Set your preferred
ANDROID_SDK_ROOT
(just like before) - Download and unpack the commandlinetools zip file into a directory called
cmdline-tools
, which is insideANDROID_SDK_ROOT
- Append the directory
$ANDROID_SDK_ROOT/cmdline-tools/tools/bin
to environment variablePATH
, so that the system knows where to findsdkmanager
!!UPDATE!!
The behavior has changed again since the build 6858069
(Android SDK Command-line Tools 3.0):
- After unzipping the package, the top-most directory you'll get is
cmdline-tools
. - Rename the unpacked directory from
cmdline-tools
totools
, and place it under$ANDROID_SDK_ROOT/cmdline-tools
, so now it should look like:$ANDROID_SDK_ROOT/cmdline-tools/tools
. And inside it, you should have:NOTICE.txt bin lib source.properties
. Actually according to the official Command-Line Tools doc, the tree structure should beandroid_sdk/cmdline-tools/version/bin/
, but I've checked, usingversion
ortools
makes no difference here. - For your environment variable
PATH
, I would recommend you to set like this:PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin
, because after update later, you'll get the latestsdkmanager
placed under$ANDROID_SDK_ROOT/cmdline-tools/latest/bin
, put it in front will make it higher priority.
Related Topics
No Generated R.Java File in My Project
Html: Why Does Android Browser Show "Go" Instead of "Next" in Keyboard
How to Take a Screenshot of a Current Activity and Then Share It
Error Message 'Java.Net.Socketexception: Socket Failed: Eacces (Permission Denied)'
Get Android API Level of Phone Currently Running My Application
Android Studio Emulator Does Not Come with Play Store for API 23
Jetpack Compose - Order of Modifiers
Get Spinner Selected Items Text
Android Appcompat 21 Elevation
No Internet on Android Emulator - Why and How to Fix
Media Queries Not Behaving as Expected on Android
Install Shows Error in Console: Install Failed Conflicting Provider
Remove Listview Items in Android
Different Font Size of Strings in the Same Textview
Android Layout Replacing a View with Another View on Run Time