How to build android

Use sudo apt-get purge command to remove the alert when i sudo apt-get install to install any software.

lut@lut-X405UA:/usr$ sudo apt-get purge oracle-java6-installer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
.
.
.

when you dont see the start menu, using the following command to reinstall the desktop and related software, eg. terminal, firfox, and so on.

  sudo apt-get install --reinstall ubuntu-desktop
  sudo apt-get install unity  

after that use sudo shutdown -r now to restart the system.

set repo

$ mkdir ~/bin
$ PATH=~/bin:$PATH

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

repo command ref

using the follow command to switch python3 to virtual python2 enviroment
about how to construct virtualenv pls see ref

lut@lut-X405UA:~/Downloads$ source ~/anaconda3/bin/pyenv/bin/activate

using this command to downloads android source code

(pyenv) lut@lut-X405UA:~/Downloads/androidsource$ repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/

the repo config is in~/.reopconfig/

the reason of using --repo-url it that because if you dont add this item will response
mirror of tsinghua

 fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle

then use

repo sync

install jdk8

sudo apt-get update
sudo apt-get install openjdk-8-jdk

install jdk7

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

switch of different jdk version

sudo update-alternative --config java
sudo update-alternative --config javac
or
sudo update-alternatives --config java
sudo update-alternatives --config javac

relate lib dependency on ubuntu16.04

sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib 
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386 
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential  
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib 
sudo apt-get install libc6-dev-i386 
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev 
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4
sudo apt-get install lib32z-dev ccache

initial complier environments

source build/envsetup.sh

lunch select complier target

lunch aosp_arm64-eng  # or only use lunch command then select the target

switch to python2 environments

lut@lut-X405UA:~/anaconda3/bin$ virtualenv -p /usr/bin/python2.7 pyenv
source ~/anaconda3/bin/pyenv/bin/activate

start build

sudo make -j8

-j8 means use 8 threads to build the project.

next

sourch build/envsetup.sh

initial build environment
then lunch

 
lut@lut-X405UA:/media/lucient/59A633800E2D6D3D/androidsource$ lunch 

You're building on Linux

Lunch menu... pick a combo:
     1. aosp_arm-eng
     2. aosp_arm64-eng
     3. aosp_mips-eng
     4. aosp_mips64-eng
     5. aosp_x86-eng
     6. aosp_x86_64-eng
     7. full_fugu-userdebug
     8. aosp_fugu-userdebug
     9. aosp_car_emu_arm-userdebug
     10. aosp_car_emu_arm64-userdebug
     11. aosp_car_emu_x86-userdebug
     12. aosp_car_emu_x86_64-userdebug
     13. mini_emulator_arm64-userdebug
     14. m_e_arm-userdebug
     15. m_e_mips64-eng
     16. m_e_mips-userdebug
     17. mini_emulator_x86_64-userdebug
     18. mini_emulator_x86-userdebug
     19. uml-userdebug
     20. aosp_cf_x86_auto-userdebug
     21. aosp_cf_x86_phone-userdebug
     22. aosp_cf_x86_tablet-userdebug
     23. aosp_cf_x86_tablet_3g-userdebug
     24. aosp_cf_x86_tv-userdebug
     25. aosp_cf_x86_wear-userdebug
     26. aosp_cf_x86_64_auto-userdebug
     27. aosp_cf_x86_64_phone-userdebug
     28. aosp_cf_x86_64_tablet-userdebug
     29. aosp_cf_x86_64_tablet_3g-userdebug
     30. aosp_cf_x86_64_tv-userdebug
     31. aosp_cf_x86_64_wear-userdebug
     32. cf_x86_auto-userdebug
     33. cf_x86_phone-userdebug
     34. cf_x86_tablet-userdebug
     35. cf_x86_tablet_3g-userdebug
     36. cf_x86_tv-userdebug
     37. cf_x86_wear-userdebug
     38. cf_x86_64_auto-userdebug
     39. cf_x86_64_phone-userdebug
     40. cf_x86_64_tablet-userdebug
     41. cf_x86_64_tablet_3g-userdebug
     42. cf_x86_64_tv-userdebug
     43. cf_x86_64_wear-userdebug
     44. aosp_dragon-userdebug
     45. aosp_dragon-eng
     46. aosp_marlin-userdebug
     47. aosp_marlin_svelte-userdebug
     48. aosp_sailfish-userdebug
     49. aosp_walleye-userdebug
     50. aosp_walleye_test-userdebug
     51. aosp_taimen-userdebug
     52. aosp_angler-userdebug
     53. aosp_bullhead-userdebug
     54. aosp_bullhead_svelte-userdebug
     55. hikey-userdebug
     56. hikey960-userdebug

Which would you like? [aosp_arm-eng] 1 # select the same item with upon

============================================
PLATFORM_VERSION_CODENAME=P
PLATFORM_VERSION=P
TARGET_PRODUCT=aosp_arm
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.13.0-26-generic-x86_64-Ubuntu-16.04.3-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=OC-MR1
OUT_DIR=out
============================================
lut@lut-X405UA:/media/lucient/59A633800E2D6D3D/androidsource$ ls

finally
run emulator

lut@lut-X405UA:/media/lucient/59A633800E2D6D3D/androidsource$ emulator
emulator: WARNING: system partition size adjusted to match image file (2050 MB > 200 MB)

emulator: WARNING: encryption is off
emulator: INFO: boot completed

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末乔宿,一起剝皮案震驚了整個濱河市托修,隨后出現(xiàn)的幾起案子晋修,更是在濱河造成了極大的恐慌,老刑警劉巖烟阐,帶你破解...
    沈念sama閱讀 218,755評論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異紊扬,居然都是意外死亡蜒茄,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,305評論 3 395
  • 文/潘曉璐 我一進(jìn)店門餐屎,熙熙樓的掌柜王于貴愁眉苦臉地迎上來檀葛,“玉大人,你說我怎么就攤上這事腹缩∮炝” “怎么了?”我有些...
    開封第一講書人閱讀 165,138評論 0 355
  • 文/不壞的土叔 我叫張陵庆聘,是天一觀的道長胜臊。 經(jīng)常有香客問我,道長伙判,這世上最難降的妖魔是什么象对? 我笑而不...
    開封第一講書人閱讀 58,791評論 1 295
  • 正文 為了忘掉前任,我火速辦了婚禮宴抚,結(jié)果婚禮上勒魔,老公的妹妹穿的比我還像新娘。我一直安慰自己菇曲,他們只是感情好冠绢,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,794評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著常潮,像睡著了一般弟胀。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上喊式,一...
    開封第一講書人閱讀 51,631評論 1 305
  • 那天孵户,我揣著相機(jī)與錄音,去河邊找鬼岔留。 笑死夏哭,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的献联。 我是一名探鬼主播竖配,決...
    沈念sama閱讀 40,362評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼何址,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了进胯?” 一聲冷哼從身側(cè)響起用爪,我...
    開封第一講書人閱讀 39,264評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎龄减,沒想到半個月后项钮,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,724評論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡希停,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,900評論 3 336
  • 正文 我和宋清朗相戀三年烁巫,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片宠能。...
    茶點(diǎn)故事閱讀 40,040評論 1 350
  • 序言:一個原本活蹦亂跳的男人離奇死亡亚隙,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出违崇,到底是詐尸還是另有隱情阿弃,我是刑警寧澤,帶...
    沈念sama閱讀 35,742評論 5 346
  • 正文 年R本政府宣布羞延,位于F島的核電站渣淳,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏伴箩。R本人自食惡果不足惜入愧,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,364評論 3 330
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望嗤谚。 院中可真熱鬧棺蛛,春花似錦、人聲如沸巩步。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,944評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽椅野。三九已至终畅,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間竟闪,已是汗流浹背声离。 一陣腳步聲響...
    開封第一講書人閱讀 33,060評論 1 270
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留瘫怜,地道東北人。 一個月前我還...
    沈念sama閱讀 48,247評論 3 371
  • 正文 我出身青樓本刽,卻偏偏與公主長得像鲸湃,于是被迫代替她去往敵國和親赠涮。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,979評論 2 355

推薦閱讀更多精彩內(nèi)容