Android學習心得之 Linux下命令列Android開發環境的搭建

來源:互聯網
上載者:User

標籤:

Android學習心得之 Linux下命令列Android開發環境的搭建

1. 前言
2. Java以及Ant安裝
3. Android SDK安裝
4. Android工程的基礎命令

 

一、前言

本篇博文記錄了Linux下全命令列的Android開發環境的搭建,本文內容基於以下文章:

http://zyqhi2010.blog.163.com/blog/static/171589378201261093235290/               ( Linux中搭建基於Emacs的Android開發環境 )
https://linux.cn/article-5966-1.html                                    (打造一個全命令列的Android構建系統)
http://stackoverflow.com/questions/25646856/android-sdk-tools-ant-build-xml698-null-returned-1     (android-sdk/tools/ant/build.xml:698: null returned: 1)
http://blog.chinaunix.net/uid-20665441-id-1758913.html                       (與android project相關的命令列 )
http://my.oschina.net/u/559701/blog/75333?fromerr=iCEvYcVH                      (在linux下使用ant建立編譯Android項目)
http://blog.csdn.net/zhangzeyuaaa/article/details/40047585                        (手動建立、構建並安裝android項目)
http://blog.csdn.net/xieyan0811/article/details/7400137                        (使用Ant編譯Android工程(Linux系統))

 

二、 Java以及Ant安裝

對於Linux下Java的安裝,可以參考之前部落格:Java學習心得之 Linux下搭建Java環境 。

對於Linux下Ant的安裝,可以參考之前部落格:Linux學習心得之 Linux下ant安裝與使用 。

 

三、Android SDK安裝

1. 下載 android 的SDK的Linux版本,並解壓。

2. 64位系統需要安裝相應的包,網上有各種不同解釋,例如libc6:i386、libncurses5:i386、libstdc++6:i386、lib32z1
註: 本次只安裝了lib32z1包,即完成環境搭建

3. 在/etc/profile,配置環境變數如下:

# set Android environmentexport ANDROID=/home/xp/Documents/SDK/Androidexport PATH=$PATH:$ANDROID/tools:$ANDROID/platform-tools

4. 終端輸入android,下載相應版本的Android SDK tools

 

四、Android工程的基礎命令

(1) 查看可選的android平台ID: 

android list target

 

(2) 建立新的android工程:

android create project -n HelloWorld -t 1 -p ./ -k com.fxt.helloworld -a Helloworld

-n指定項目的名稱
-t指定android平台
-p指定項目存放路徑
-k指定項目包名
-a指定Activity名稱

 

(3) 編譯工程


a) 編譯debug版本

$ ant debug

產生帶debug簽名的apk

 

b) 產生release版本

$ ant release

產生帶未簽名的apk,之後手動簽名即可

 

Android學習心得之 Linux下命令列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.