beginning android2,读书笔记[Android Beginning 2] chapter 1

Chapter 2 Projects and Targets

========

AndroidManifest.xml contains the "table of contents" for your application, listing all of the major application components, permissions, and so on.

The manifest is used by Android at runtime totie your application into the OS.

The manifest contents are also used by the Android Market to specify the OS version.

========

Create a android project in command line:

android create project -n HelloAndroid -t 2 -p ./hello-android -a MainActivity -k apt.tutorial

========

Project Structure

AndroidManifest.xml

build.xml --> Ant

default.properties and local.properties --> Ant

assets/ --> A folder that holds other static files you wish packaged it with the application

bin/ --> A folder that holds the applcation once it is compiled

gen/ --> where Android's build tools will place source code that they generate.

libs/ --> A folder that holds anyy third party JARs your application requires.

src/ --> Java source code

res/ --> resources files(icons, gui layouts, strings, etc.)

tests/ --> A folder that holds an entirely sperate Android project used for testing the one you created.

Some files should not be checked in the Version Control Systems:

local.properities

bin/

gen/

========

Commands to build Android project

ant help

ant clean

ant compile

ant debug

ant release

ant install

ant uninstall

========

R.java: This contains a number of constants tied to the various resources you placed in the res/ directory tree.

========

res/drawable/: For images

res/layout/: For XML-based UI layout specifications

res/menu/: For XML-based menu specifications

res/raw/: For general-purpose files

res/values/: For strings, dimenstions and the like

res/xml/: For other general-purpose XML files you wish to ship

========

bin/classes/: Holds the compiled Java classes

bin/classes.dex: Holds the executable created from those compiled Java classes.

bin/yourapp.ap_: Holds your application's resources, packaged as a ZIP file.

bin/yourapp-debug.apk: application signed by the debug key.

bin/yourapp-unsigned.apk: build result of "ant release", the APK still needs to be signed using jarsigner and an official key.

========

AndroidManifest.xml

* package attribute:

* uses-permission elements:

* permission elements:

* instrumentation elements:

* uses-library elements:

* uses-sdk elements:

* application element:

========

activity element

android:name: the class implementing the activity

android:label: the display name of the activity

intent-filter: describe under which conditions this activity will be displayed.

provider elements:

--> content provider component, supply data to your activities and with your permission, other activities in other applications on the device.

service elements:

long-running pieces of code that can operate independently of any activity.

========

If you want to ensure your application is run only on devices that have certain version or higher of the Android environment, you will add a uses-sdk element.

If you omit the element, your application will behave as though minSdkVersion is set to 1.

1: Android 1.0 SDK

2: Android 1.1 SDK

3: Android 1.5 SDK

4: Android 1.6 SDK

5: Android 2.0 SDK

6: Android 2.0.1 SDK

7: Android 2.1 SDK

8: Android 2.2 SDK

9: Android 2.3 SDK

10: Android 2.3.3/4 SDK

11: Android 3.0 SDK

12: Android 3.1 SDK

========

Version = Control

you should add a pair of attributes to the root element:

android:versionCode and android:versionName, these assist in the process of upgrading applications.

android:versionName attribute is some human-readable label for the version name or number of your application.

android:versionCode attribute is a pure integer indication of the version of the application. This is used by the system to determine if one version of your application is newer than another. Newer is defined as "has a higher android:versionCode value."

Simply increase the value of android:versionCode by one for each release of the application.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值