Download Teach Yourself Android Application Development in 24

Transcript
82
HOUR 5: Configuring the Android Manifest File
Naming Android Packages
You define the package within the Android manifest file in the <manifest> tag,
using the package attribute, as follows:
<manifest
xmlns:android=”http://schemas.android.com/apk/res/android”
package=”com.androidbook.droid1”
android:versionCode=”1”
android:versionName=”1.0”>
By the
Way
If you use the Android project wizard in Eclipse to create a project, you must fill in
the package name at that time. That package name is used in the default Android
manifest file.
Linking Secondary Libraries
Applications can use the <uses-library> tag to link to other libraries in addition to
the standard Android packages. This feature is available on the Application tab of
the resource editor. Here’s an example:
<uses-library
android:name=”com.company.sharedutilities” />
Versioning an Application
Manifest version information is used for two purposes:
. To organize and keep track of application features
. To manage application upgrades
For this reason, the <manifest> tag has two separate version attributes: a version
name and a version code.
Setting the Version Name
The version name is the traditional versioning information, used to keep track of
application builds. Smart versioning is essential when publishing and supporting
applications. The <manifest> tag android:versionName attribute is a string value
provided to keep track of the application build number. For example, the Droid1
project has the version name 1.0. The format of the version name field is up to the
developer. However, note that this field is visible to the user.
Setting the Version Code
The version code allows the Android platform to programmatically upgrade and
downgrade an application. The <manifest> tag android:versionCode attribute is