A few months ago,I dealed with a task:To build a large amount of apk files. The trick I came up with is to build apk file from the command so that I could use Python to glue all the works. Eventually I made it.And so this post is to make some description about the trick.
Setup Android SDK
Generate R class file
Compile Java codes(.java files) into classes(.class) files
-encoding encoding Set the source file encoding name, such as EUC-JP and UTF-8. If -encoding is not specified, the platform default converter is used.
-source release Specifies the version of source code accepted, Please Do NOT use Java 7(1.7)
-target version Generate class files that target a specified version of the VM. Class files will run on the specified target and on later versions, but not on earlier versions of the VM. Valid targets are 1.1, 1.2, 1.3, 1.4, 1.5 (also 5), 1.6(also 6), and 1.7 (also 7).
-bootclasspath bootclasspath Cross-compile against the specified set of boot classes. As with the user class path, boot class path entries are separated by colons (:) and can be directories, JAR archives, or ZIP archives.
-d directory Set the destination directory for class files. The directory must already exist; javac will not create it.
As I have suffered a lot using Java 7, It’s recomended to use Java 6