-
-d <目录> 指定存放生成的类文件的位置
-
-s <目录> 指定存放生成的源文件的位置
-
-implicit:{none,class} 指定是否为隐式引用文件生成类文件
-
-encoding <编码> 指定源文件使用的字符编码
-
-source <版本> 提供与指定版本的源兼容性
-
-target <版本> 生成特定 VM 版本的类文件
-
-version 版本信息
-
-help 输出标准选项的提要
-
-Akey[=value] 传递给注释处理程序的选项
-
-X 输出非标准选项的提要
-
-J<标志> 直接将 <标志> 传递给运行时系统
例子:
javac -encoding utf-8 -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
第四步:把.class文件转化成Davik VM支持的.dex文件
将工程bin目录下的class文件编译成classes.dex,Android虚拟机只能执行dex文件!
例子:
第五步:打包生成未签名的.apk文件
【输入】打包后的资源文件、打包后类文件(.dex文件)、libs文件(包括.so文件,当然很多工程都没有这样的文件,如果你不使用C/C++开发的话)
【输出】未签名的.apk文件
【工具】apkbuilder工具
apkbuilder工具用法如下:
-
-v Verbose.
-
-d Debug Mode: Includes debug files in the APK file.
-
-u Creates an unsigned package.
-
-storetype Forces the KeyStore type. If ommited the default is used.
-
-z Followed by the path to a zip archive.
-
Adds the content of the application package.
-
-f Followed by the path to a file.
-
Adds the file to the application package.
-
-rf Followed by the path to a source folder.
-
Adds the java resources found in that folder to the application
-
package, while keeping their path relative to the source folder.
-
-rj Followed by the path to a jar file or a folder containing
-
jar files.
-
Adds the java resources found in the jar file(s) to the application
-
package.
-
-nf Followed by the root folder containing native libraries to
-
include in the application package.
列子:
apkbuilder {output.apk.file} -u -z {output.apk.file} -u -z {output.apk.file} -u -z {packagedresource.file} -f {dex.file} -rf {dex.file} -rf