Android-how to package with command line, android-command line

Source: Internet
Author: User

Android-how to package with command line, android-command line

Reprinted please indicate the source: http://blog.csdn.net/goldenfish1919/article/details/40978859

1. Generate the R File

Aapt package-f-m-J./gen-S res-M AndroidManifest. xml-I D: \ adt-bundle-windows-x86_64-20131115 \ sdk \ platforms \ android-19 \ android. jar

-F if the compiled file already exists, forcibly overwrite it.
-M stores the directory of the generated package in the directory specified by the-J Parameter
-J: Specifies the output directory path of the generated R. java file.
-S: Specify the res folder path
-I: Specifies the path of the android. jar file of a specific platform version.
-A: Specifies the path of the assert folder.

2. Generate the class file
Javac-bootclasspath D: \ adt-bundle-windows-x86_64-20131115 \ sdk \ platforms \ android-19 \ android. jar-d bin src \ com \ example \ hello \*. java gen \ com \ example \ hello \ R. java
 
-Target <version> generates class files of a specific VM version.
-Bootclasspath <path> overwrites the position of the boot class file
-D <directory> specifies the location where the generated class files are stored.
-Sourcepath <path> specifies the location of the Input Source file to be searched.

3. Compress into a jar package
Cd bin
Jar cvf hello. jar *

4. Generate the dex File
Cd ..
Dx -- dex -- output = bin \ classes. dex bin \ hello. jar
-- Output = <classes. dex path to be generated> <path of the class file to be processed>

5. Package Resources
Aapt package-f-M AndroidManifest. xml-S res-I D: \ adt-bundle-windows-x86_64-20131115 \ sdk \ platforms \ android-19 \ android. jar-F bin \ resources. ap _
-F if the compiled file already exists, forcibly overwrite it
-M specifies the path of AndroidManifest. xml
-S: Specify the res folder path
-I: Specifies the path of android. jar for a specific platform version.
-F specifies the full path of the output file

6. generate an apk
Java-cp D: \ adt-bundle-windows-x86_64-20131115 \ sdk \ tools \ lib \ sdklib. jar com. android. sdklib. build. apkBuilderMain hello.apk-v-u-z bin \ resources. ap _-f bin \ classes. dex-rf src
-V Verbose displays Process Information
-U: Create an unsigned package
-Z: Specify the apk resource path
-F specifies the dex file path
-Rf specifies the source code path

7. sign the apk. The Auto-sign tool is used here.
Cd..././Auto-sign
Java-jar signapk. jar testkey. x509.pem testkey. pk8 ../command line packaging/hellodemo/hello.apk ../command line packaging/hellodemo/hellosign.apk

Reference: http://blog.csdn.net/androiddevelop/article/details/10948639





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.