This section describes the Android application project build process which consists of 7 steps: Resource code generation, Interface code generation, Java Compilation, Byte code conversion, Packaging, Signing, and Package optimization.
Before going into details of the Android project build process, let's look this
build process diagram provided in the Android document:
The build process can be summarized as below:
Resource code generation - The aapt (Android Asset Packaging Tool) tool takes your application resource files, such as the AndroidManifest.xml file
and the XML files for your Activities, and compiles them. An R.java is also produced so you can reference your resources
from your Java code.
Interface code generation - The aidl (Android Interface Definition Language) tool converts any .aidl interfaces that you have into Java interfaces.
Java compilation - The javac (Java Compiler) tool compiles all of your Java code, including the R.java and .aidl files,
into .class files.
Byte code conversion - The dex tool converts the .class files to Dalvik byte code. Any 3rd party libraries and .class files
that you have included in your project are also converted into .dex files so that they can be packaged
into the final .apk file.
Packaging - The apkbuilder tool packages all non-compiled resources (such as images), compiled resources,
and the .dex files into an .apk file.
Signing the package - The jarsigner tool signs the .apk file with a debug key or a release key
it can be installed to a device.
Package optimization - The zipalign tool
aligns the files in the .apk package to decreases memory usage when the application is running on a device.