OSX android 編譯環境

來源:互聯網
上載者:User

標籤:

1 安裝Xcode

MacPort

註:確定/opt/local/bin在/usr/bin之前,如果沒有,執行以下命令,或者修改.bash_profile

        export PATH=/opt/local/bin:$PATH

 

2 通過MacPort安裝make,git,GPG, 如果本地已經安裝,或者版本已經比較新了,無需安裝

       sudo port install gmake libsdl git-core gnupg

 

3  關於make 3.82版本

      make 3.82版本有bug,需要退回3.81,通過以下命令確認版本

    make -v

GNU Make 3.81

Copyright (C) 2006  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.

 

This program built for i386-apple-darwin11.0

 

因為我的機器上已經是3.81版本所以沒用操作這個過程,具體可以查閱Android 官網

 

4  修改檔案描述符限制

 在~/.bash_profile中添加以下內容

# set the number of open files to be 1024

ulimit -S -n 1024

 

二. 下載源碼

1. 建立目錄~/bin

mkdir ~/bin

添加以下命令到~/.bash_profile

export PATH=~/bin:$PATH

2. 安裝repo,這裡沒用安裝官網文檔來,具體原因你懂得

$ curl https://git-repo.googlecode.com/files/repo-1.19 > ~/bin/repo

然後修改repo為可執行許可權

chmod a+x ~/bin/repo

3. 為了方便下載,修改repo檔案,如下

#REPO_URL = ‘http://gerrit.googlesource.com/git-repo‘

REPO_URL=‘http://code.google.com/p/git-repo/‘

4. 建立個源碼目錄mkdir android-source準備下載

 

cd android-source

 

5. 執行repo init, git庫和官網的不一樣,原因不解釋

從master 下載源碼

 

repo init -u git://Android.git.linaro.org/platform/manifest.git

 

或者 分支上下載

repo init -u git://Android.git.linaro.org/platform/manifest.git -b “branch tag”

我選擇的是比較新的android-4.4.2_r1

repo init -u git://Android.git.linaro.org/platform/manifest.git -b android-4.4.2_r1

 

可以在官網查看你想要下載的源碼對應的tag,

執行完之後,在本地會有個目錄.repo

然後在android-source目錄下執行repo sync下載代碼

下載代碼需要很長時間,如果感覺沒用繼續下載,可以ctrl+c殺掉,繼續執行repo sync 直到下載完成。

 

下載完成後,android-source下一共27G,.repo 17G, 源碼10G左右

 

三. 可以編譯代碼

將代碼從android-source目錄拷貝到掛載的之前建立的分區/Volumes/android,然後在這個分區下可以刪除.repo目錄,這個目錄在編譯代碼時,沒用並且佔去很多空間

1. 初始化編譯環境

source build/envsetup.sh

 

2. 選擇編譯目標,具體查閱官網

lunch full-eng

3. 編譯代碼

make

或者

make -j4

OSX android 編譯環境

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.