Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ubuntu 14.04 command line install android sdk
# install openjdk
sudo apt-get install openjdk-7-jdk
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
# install all sdk packages
./android update sdk --no-ui
# set path
vi ~/.zshrc << EOT
export PATH=${PATH}:$HOME/sdk/android-sdk-linux/platform-tools:$HOME/sdk/android-sdk-linux/tools:$HOME/sdk/android-sdk-linux/build-tools/22.0.1/
EOT
source ~/.zshrc
# adb
sudo apt-get install libc6:i386 libstdc++6:i386
# aapt
sudo apt-get install zlib1g:i386
@dflourusso

This comment has been minimized.

dflourusso commented Feb 1, 2016

Very usefull, thanks :)

@pradeep-rajapaksha

This comment has been minimized.

pradeep-rajapaksha commented Feb 23, 2016

Saved my day! Tnx!

@edwinrajadurai

This comment has been minimized.

edwinrajadurai commented Mar 4, 2016

Thanks!

@manojrpms

This comment has been minimized.

manojrpms commented Mar 19, 2016

thanx

@dvrajan

This comment has been minimized.

dvrajan commented Mar 21, 2016

Thank you! Good one!

@djuniorscjr

This comment has been minimized.

djuniorscjr commented Mar 29, 2016

Thanks!!

@tekknikk

This comment has been minimized.

tekknikk commented Mar 30, 2016

rock and roll

@Noveltysa

This comment has been minimized.

Noveltysa commented Apr 6, 2016

Ou thank you greatly; This is very usefull

@nishantkashyap

This comment has been minimized.

nishantkashyap commented Apr 11, 2016

Thank you !

@sunset1115

This comment has been minimized.

sunset1115 commented Apr 14, 2016

Thank you!

@PierreGe

This comment has been minimized.

PierreGe commented Apr 24, 2016

It helped me speed up installation, thank you!

@krestt

This comment has been minimized.

krestt commented Apr 27, 2016

I love you wenzhixin!!!

@brankosimic

This comment has been minimized.

brankosimic commented Apr 28, 2016

Thanks

@Kalyan14

This comment has been minimized.

Kalyan14 commented Apr 28, 2016

Thank you sooo much :)

@vdelacou

This comment has been minimized.

vdelacou commented May 2, 2016

Thank you

@ghost

This comment has been minimized.

ghost commented May 12, 2016

Thank you

@uolcano

This comment has been minimized.

uolcano commented May 17, 2016

thx

@gautamkishore

This comment has been minimized.

gautamkishore commented May 31, 2016

I was preparing this, thanks for saving my time :)

@nuntius-rex

This comment has been minimized.

nuntius-rex commented Jun 3, 2016

DUDE! Thank you!

@mjseyyedi

This comment has been minimized.

mjseyyedi commented Jun 4, 2016

sorry , I followed your instrction and now have a problem and it's that when I try to build my android app , I get the error below

Error: Please install Android target: "android-23".

Hint: Open the SDK manager by running: /home/hunter/Documents/android-sdk-linux/tools/android
You will require:

  1. "SDK Platform" for android-23
  2. "Android SDK Platform-tools (latest)
  3. "Android SDK Build-tools" (latest)

here is my sdk manager photo
http://i.stack.imgur.com/Ah216.png

please help me

@Yhochanan

This comment has been minimized.

Yhochanan commented Jun 8, 2016

At the line 18 gave me an error:
Vim: Warning: Input is not from a terminal
Vim: Error reading input, exiting...
Vim: preserving files...
Vim: Finished.
If any solution thank you a lot
-- Ubuntu 16.04

@mitorski

This comment has been minimized.

mitorski commented Jun 9, 2016

Confirm with @Yhochanan, dosen't work with 16.04.

@qwertyI

This comment has been minimized.

qwertyI commented Jun 12, 2016

it's work for me!thx

@DelhiPanda

This comment has been minimized.

DelhiPanda commented Jun 13, 2016

THNX!!!

@pennyplayer

This comment has been minimized.

pennyplayer commented Jun 28, 2016

@Yhochanan I had the same error. I found that a vim swap file already existed and the file zshrc had some errors in it from a previous install. I deleted the swap file, then opened zshrc, fixed the errors and added the path.

-- Ubuntu 14.04

@marty-Wallace

This comment has been minimized.

marty-Wallace commented Jul 4, 2016

This wouldn't work for me because it installed the android-sdk-linux directory in my home directory rather than in a directory named sdk. Created a directory named sdk and moved the android-sdk-linux directory into it and it worked like a charm afterwards.

Thanks.
--Ubuntu 15.10

@kat0072

This comment has been minimized.

kat0072 commented Jul 12, 2016

Thanks a lot.

Please add the Phablet tools setup as well those need to download the repo's and build source locally

sudo apt-get install phablet-tools

@nanusdad

This comment has been minimized.

nanusdad commented Jul 23, 2016

Thanks ! This was very useful !

@cedxix

This comment has been minimized.

cedxix commented Aug 9, 2016

Thank you !

@yadejo

This comment has been minimized.

yadejo commented Aug 18, 2016

Thanks!

@junaediwidjojo

This comment has been minimized.

junaediwidjojo commented Aug 30, 2016

thank you

@shivasurya

This comment has been minimized.

shivasurya commented Sep 13, 2016

useful! may be i can contribute for gentoo linux

@shivasurya

This comment has been minimized.

shivasurya commented Sep 13, 2016

this is for Gentoo Linux Android SDK Command line installation guide https://gist.github.com/shivasurya/11aaf7d340bd37f9e501c59223a1febe

@lansanasylla

This comment has been minimized.

lansanasylla commented Sep 17, 2016

very helpful,
thanks

@vg123

This comment has been minimized.

vg123 commented Sep 20, 2016

vi ~/.zshrc << EOT

export PATH=${PATH}:$HOME/sdk/android-sdk-linux/platform-tools:$HOME/sdk/android-sdk-linux/tools:$HOME/sdk/android-sdk-linux/build-tools/22.0.1/

EOT
Vim: Warning: Input is not from a terminal
Vim: Error reading input, exiting...
Vim: preserving files...
Vim: Finished.

please suggest any good solution for this error i need android studio urgently...

@pankaj9296

This comment has been minimized.

pankaj9296 commented Sep 21, 2016

use nano editor.
nano ~/.zshrc
and put that line and save with ctrl+x

@fidelis

This comment has been minimized.

fidelis commented Sep 26, 2016

Very usefull, thak you indeed!

@AstralisSomnium

This comment has been minimized.

AstralisSomnium commented Sep 28, 2016

I use it for an environment without any userinput, so I get the exception:
Package not installed due to rejected license ''.

Before it asks y/n for accepting all licenses but my build machine just enters "", so how can I fix this?

SOLVED:

I got it working by replacing following line:
./android update sdk --no-ui
with:
echo "y" | ./android update sdk --no-ui

@adibas03

This comment has been minimized.

adibas03 commented Oct 4, 2016

L#11 has been updated to

./android update sdk -u

@qti3e

This comment has been minimized.

qti3e commented Oct 13, 2016

Very useful, it saved my life!

@zunjae

This comment has been minimized.

zunjae commented Oct 18, 2016

thanks!!!

@GeorgiPachov

This comment has been minimized.

GeorgiPachov commented Oct 19, 2016

Came here to say thank you for sharing : )

@shinasnp

This comment has been minimized.

shinasnp commented Oct 20, 2016

Thanks bro...Very Useful.

@CornejoReyes

This comment has been minimized.

CornejoReyes commented Oct 20, 2016

Thank you dude, helpful!

@emadhura

This comment has been minimized.

emadhura commented Oct 27, 2016

thankz

@TheBlackDude

This comment has been minimized.

TheBlackDude commented Oct 27, 2016

Awesoem

but for Ubuntu 16.04 you need to do this first

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jre

@obonyojimmy

This comment has been minimized.

obonyojimmy commented Nov 1, 2016

@TheBlackDude , here is the spellings of "Awesoem" > "Awesome"

@i-gabdushev

This comment has been minimized.

i-gabdushev commented Nov 3, 2016

If you getting E: Couldn't find any package by regex 'libstdc++6' and E: Unable to locate package zlib1g on last commands

$ sudo apt-get install libc6:i386 libstdc++6:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libc6
E: Unable to locate package libstdc++6
E: Couldn't find any package by regex 'libstdc++6'
$ sudo apt-get install zlib1g:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package zlib1g

you can try

$ sudo dpkg --add-architecture i386
$ sudo apt-get update

and then repeat

# adb
sudo apt-get install libc6:i386 libstdc++6:i386
# aapt
sudo apt-get install zlib1g:i386
@luyanyan5620

This comment has been minimized.

luyanyan5620 commented Nov 10, 2016

“vi ~/.zshrc << EOT

export PATH=${PATH}:$HOME/sdk/android-sdk-linux/platform-tools:$HOME/sdk/android-sdk-linux/tools:$HOME/sdk/android-sdk-linux/build-tools/22.0.1/

EOT”
this segment code just want to add environment variable permanent,we can use other way to complete it.
like this:

1.vi /etc/profile
2.add this command:
export PATH=${PATH}:$HOME/sdk/android-sdk-linux/platform-tools:$HOME/sdk/android-sdk-linux/tools:$HOME/sdk/android-sdk-linux/build-tools/22.0.1/
3.save it
4.open a new shell and type "echo $PATH"
5. check this works.

@aakashhs

This comment has been minimized.

aakashhs commented Dec 4, 2016

Thanks a lot!!!

@Akhileshchirlancha

This comment has been minimized.

Akhileshchirlancha commented Dec 7, 2016

Thank you

@dchrostowski

This comment has been minimized.

dchrostowski commented Dec 9, 2016

This is the best piece of software on Github. I didn't have to go do things! This did all the things for me. +1000 internets for you. Also a nomination for the Nobel Peace Prize.

@aryeharmon

This comment has been minimized.

@rmsouza

This comment has been minimized.

rmsouza commented Jan 14, 2017

thanks

@herberthamaral

This comment has been minimized.

herberthamaral commented Feb 7, 2017

*warning: * running android update sdk --no-ui will install everything. Check out this blog [1] for more instructions if you want a custom install.

[1] - http://sblackwell.com/blog/2014/06/installing-the-android-sdk-on-a-headless-server/

@gougoudinho

This comment has been minimized.

gougoudinho commented Feb 15, 2017

Great.Trying it.By the way is someone can help me to unbrick my htc one sv 4G LTE;Hardbrick due to bad flashing.Thanks in advance

@gougoudinho

This comment has been minimized.

gougoudinho commented Feb 16, 2017

Great.Trying it.By the way is someone can help me to unbrick my htc one sv 4G LTE;Hardbrick due to bad flashing.Thanks in advance.Bootloader locked but S-off

@gougoudinho

This comment has been minimized.

gougoudinho commented Feb 16, 2017

Please i have an error when i reach EOT.I am on ubuntu 12.04.Can i have help?Thanks

@mauricionr

This comment has been minimized.

mauricionr commented Feb 25, 2017

🚀

@zukinaru

This comment has been minimized.

zukinaru commented Mar 9, 2017

Many Thanks :)

@vsxen

This comment has been minimized.

vsxen commented Mar 10, 2017

sometimes you may need run export ANDROID_HOME=${HOME}/android-sdk-linux/

@ashishg656

This comment has been minimized.

ashishg656 commented Mar 11, 2017

Thanks a lot for this

@jonatansouza

This comment has been minimized.

jonatansouza commented Mar 15, 2017

many thanks! o/

@boutchekkoucht

This comment has been minimized.

boutchekkoucht commented Mar 21, 2017

Merci beaucoup ^^

@valentinancy

This comment has been minimized.

valentinancy commented Mar 21, 2017

terima kasih hehe

@anoobbava

This comment has been minimized.

anoobbava commented Apr 4, 2017

Hi,
Below error pops up when executing this command.

./android update sdk --no-ui

Exception in thread "main" java.lang.NullPointerException
at java.io.File.(File.java:277)
at com.android.sdklib.internal.avd.AvdManager.parseAvdInfo(AvdManager.java:1616)
at com.android.sdklib.internal.avd.AvdManager.buildAvdList(AvdManager.java:1577)
at com.android.sdklib.internal.avd.AvdManager.(AvdManager.java:350)
at com.android.sdklib.internal.avd.AvdManager.getInstance(AvdManager.java:373)
at com.android.sdklib.internal.repository.updater.UpdaterData.initSdk(UpdaterData.java:254)
at com.android.sdklib.internal.repository.updater.UpdaterData.(UpdaterData.java:122)
at com.android.sdklib.internal.repository.updater.SdkUpdaterNoWindow.(SdkUpdaterNoWindow.java:76)
at com.android.sdkmanager.Main.updateSdkNoUI(Main.java:497)
at com.android.sdkmanager.Main.doAction(Main.java:366)
at com.android.sdkmanager.Main.run(Main.java:150)
at com.android.sdkmanager.Main.main(Main.java:116)

@vunnysher

This comment has been minimized.

vunnysher commented Apr 15, 2017

thanks

@samratBasra

This comment has been minimized.

samratBasra commented Apr 28, 2017

it works, thanks a lot.

@LeandroTorresCoutinho

This comment has been minimized.

LeandroTorresCoutinho commented May 26, 2017

very usefull, thanks!!!

@SirmaXX

This comment has been minimized.

SirmaXX commented Jun 17, 2017

you are man of the material

@Luro02

This comment has been minimized.

Luro02 commented Jun 22, 2017

would be awesome if you could merge my Fork :)
https://gist.github.com/Gnarmagon/1364394a9e4a88420a28b4db528392f3

(it copies the tar from everywhere into $HOME)

@boga01

This comment has been minimized.

boga01 commented Jun 29, 2017

so helpful

@mukana-lahtelat

This comment has been minimized.

mukana-lahtelat commented Jul 21, 2017

Do notice that this script assumes you're using ZSH, not bash. Replace .zshrc with .bashrc to fix

@vshantam

This comment has been minimized.

vshantam commented Jul 28, 2017

amazing.saved my day.thanks a lot

@Jullies

This comment has been minimized.

Jullies commented Oct 3, 2017

Thank You

@canhphong

This comment has been minimized.

canhphong commented Dec 9, 2017

thanks

@alejandrohn

This comment has been minimized.

alejandrohn commented Jan 4, 2018

Thanks

@welcomepkw

This comment has been minimized.

welcomepkw commented Apr 27, 2018

thanks bro!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment