Skip to Content
Android Developer Tools深入精要
book

Android Developer Tools深入精要

by Mike Wolfson
July 2014
Intermediate to advanced
248 pages
5h 19m
Chinese
GoTop Information, Inc.
Content preview from Android Developer Tools深入精要
130
|
第九章:建置工具
[Page-134]
ADT
工具預先安裝了
Ant
,若你已經正確地設定
PATH
路徑的話則會自動出現(查看
5
頁的「設定
PATH
變數」)。你可以執行兩種建置類型:
偵錯模式
用於測試或偵錯
app
發行模式
用於建立發佈用的程式。
建置一個
Android app
(無論哪種建置類型)包括以下步驟:
1.
Java
程式碼編譯至
DEX
位元碼。
2.
Android
專案建置成一個可發佈的
APK
檔案。
3.
簽署
APK
,則可以將
APK
部署到模擬器或是實體裝置上;要記得的是每個
app
都需要在部署之前進行簽名。
若你是利用
Eclipse
建置,則工具會自動完成這些步驟;若你是使用
Ant
從命令列模式
下執行,則有些步驟需手動完成。
[Page-135]
準備專案
為了使用
Ant
來建置,你需要新增
build.xml
檔案提供
Ant
一些建置專案所需的資訊。
在這檔案中,我們會記錄一些資訊如簽署
app
Lint
的執行或是專案的相依性。
新增
Ant
build.xml
檔案
使用過
Ant
的人會知道操作這些建置檔案並不容易;這些建置檔案很快會變龐大而混
亂。
幸運的是
ADT
提供了一個工具可以自動地產生
build.xml
。要執行此指令,開啟命令提
示字元且切換至專案的根目錄,並執行
Android update
指令,語法是:
android update project –name project_name—target target_api_id
--path path_to_project ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Android 高效能多執行緒

Android 高效能多執行緒

Anders Goransson
深入淺出 jQuery

深入淺出 jQuery

Ryan Benedetti, Ronan Cranley
HTML5 錦囊妙計

HTML5 錦囊妙計

Christopher Schmitt, Kyle Simpson

Publisher Resources

ISBN: 9789863470861