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