手动编译你的apk,可以让资源目录不命名为res, 你能够命名任何你想要的名字。
你可以在以下目录发现ant脚本: <SDK_HOME>/platforms/android-1.5/templates/android-rules.xml
第一步: 产生R文件以及包资源
aapt package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library} -S ${android-resource-directory} [-m -J ${folder.to.output.the.R.java}]
第二步:编译java源文件以及R.java文件
use javac
第三步:将classes文件转化成Dalvik自节码
use dx.bat
dx.bat –dex –output=${output.dex.file} ${compiled.classes.directory} ${jar files..}
第四步:创建未签名的apk
use apkbuilder
apkbuilder ${output.apk.file} -u -z ${packagedresource.file} -f ${dex.file}
or
apkbuilder ${output.apk.file} -u -z ${packagedresource.file} -f ${dex.file} -rf ${source.dir} -rj ${libraries.dir}
-rf = resources required for compiled source files?
-rj = resources required for jar files
第六步: 产生一个key
use keytool
第七步骤: 对APK进行签名
use jarsigner
jarsigner -keystore ${keystore} -storepass ${keystore.password} -keypass ${keypass} -signedjar ${signed.apkfile} ${unsigned.apkfile} ${keyalias}
第八步: 发布
use adb
adb -d install -r ${signed.apk}
Inspecting your APK file:
aapt list -v latest.apk
Open questions:
1. Can you include more than one dex file in the apk?
2. Can you have dex file named other than classes.dex in the apk?
3. Does an apk have to have a packaged resource?