Android command line manual compilation and packaging in the Android Series)

Source: Internet
Author: User

Android command line manual compilation and Packaging Process Diagram

[Detailed steps ]:

 

1. Use aapt to generate the R. java class file:
Example:
E: \ androidDev \ android-sdk-windows2.2 \ tools> E: \ androidDev \ android-sdk-windows2.2 \ platforms \ android-3 \ tools \ aapt.exe package-f-m-j e: \ androidDev \ AndroidByread \ gen-S res-I E: \ androidDev \ android-sdk-windows2.2 \ platforms \ android-3 \ android. jar-M AndroidManifest. xml
-F-m-j e: \ androidDev \ AndroidByread \ gen indicates generating the R with the package path under the gen directory in overwrite mode. java,-S res specifies the resource file,-I E: \ androidDev \ android-sdk-windows2.2 \ platforms \ android-3 \ android. jar specifies the android class used,-M AndroidManifest. configuration file of the specified program in xml

Aapt Usage:

2. Use aidl.exe of android sdk.exe to convert. aidl to A. java file:
Usage: aidl options input [OUTPUT]
Aidl -- preprocess output input...

 

OPTIONS:
-I <DIR> search path for import statements.
-D <FILE> generate dependency file.
-P <FILE> file created by -- preprocess to import.
-O <FOLDER> base output folder for generated files.
-B fail when trying to compile a parcelable.

INPUT:
An aidl interface file.

OUTPUT:
The generated interface files.

 

3. Compile the. java class file to generate the class file:
Example: E: \ Androiddev \ AndroidByread> javac-encoding GB18030-target 1.5-bootclasspath E: \ Androiddev \ android-sdk-windows2.2 \ platforms \ android-3 \ android. jar-d bin src \ com \ byread \ reader \*. java gen \ com \ byread \ reader \ R. java

4. Use the dx. bat command line script provided by the android SDK to generate the classes. dex file:

Example:
E: \ Androiddev \ AndroidByread> E: \ Androiddev \ r \ android-sdk-windows2.2 \ platforms \ android-3 \ tools \ dx. bat -- dex -- output = E: \ Androiddev \ AndroidByread \ bin \ classes. dex E: \ Androiddev \ AndroidByread \ bin \ classes
Classes. dex is the generated target file, and E: \ Androiddev \ AndroidByread \ bin \ classes is the directory where the class file is located.

 

5. Use aapt.exe of Android sdkscripts to generate resource package files (including res, assets, and androidmanifest. xml ):
E: \ android ID \ AndroidByread> E: \ Androiddev \ android-sdk-windows2.2 \ platforms \ android-3 \ tools \ aapt.exe package-f-M AndroidManifest. xml-S res-A assets-I E: \ Androiddev \ android-sdk-windows2.2 \ platforms \ android-3 \ android. jar-F bin \ byreadreader
Package the resource files in the AndroidManifest. xml, res, and assets folders to generate byreadreader. For usage instructions, see 1

6. generate an unsigned apk Installation File in Step 6:
Apkbuilder extends output.apk. file}-u-z $ {packagedresource. file}-f $ {dex. file}-rf $ {source. dir}-rj $ {libraries. dir}

For example, E: \ Adnroiddev \ AndroidByread> E: \ Adnroiddev \ android-sdk-windows2.2 \ tools \ apkbuilder. bat E: \ Adnroiddev \ byreader.apk-v-u-z E: \ Adnroiddev \ AndroidByread \ bin \ byreadreader-f E: \ Adnroiddev \ AndroidByread \ bin \ class. dex-rf E: \ Adnroiddev \ AndroidByread \ src where E: \ Adnroiddev \ byreadreader.apk is the generated apk,-z E: \ Adnroiddev \ AndroidByread \ bin \ byreadreader is the resource package, E: \ Adnroiddev \ AndroidByread \ bin \ class. dex is a class package

 

7. use the jdk jarsigner to sign the apk for the unsigned package: use jarsigner-keystore $ {keystore}-storepass $ {keystore. password}-keypass $ {keypass}-signedjar using your signed.apk file} using your unsigned.apk file }$ {keyalias} example: E: \ Adnroiddev \ android-sdk-windows2.2 \ tools> jarsigner-keystore E: \ Adnroiddev \ eclipse3.5 \ bbyread. keystore-storepass byread002-keypass byread002-signedjar E: \ Adnroiddev \ byread.apk E: \ Adnroiddev \ byreadreader . Apk byread where-keystore E: \ Adnroiddev \ eclipse3.5 \ bbyread. keystore is the key file-storepass byread002 is the Key File Password byread is the key alias-keypass byread002 is the key alias password,-signedjar E: \ Adnroiddev \ byread.apk is the signature generated apk file E: \ Adnroiddev \ byreader.apk is an unsigned file.
Http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.