手動 命令列打包 apk 示例(在最下面)
阿新 • • 發佈:2019-01-28
5使用Android SDK提供的aapt.exe生成資源包檔案(包括res、assets、androidmanifest.xml等):
F:\explorer\AndroidByread>F:\explorer\android-sdk-windows2.2\platforms\android-3\tools\aapt.exe package -f -M AndroidManifest.xml -S res -A assets -I F:\explorer\android-sdk-windows2.2\platforms\android-3\android.jar -F bin\byreadreader
將AndroidManifest.xml,res和assets資料夾中的資原始檔打包生成byreadreader,用法參見1
6第六步 生成未簽名的apk安裝檔案:
apkbuilder ${output.apk.file} -u -z ${packagedresource.file} -f ${dex.file} -rf ${source.dir} -rj ${libraries.dir}
例:
F:\explorer\AndroidByread>f:\explorer\android-sdk-windows2.2\tools\apkbuilder.bat f:\explorer\byreadreader.apk –v -u -z f:\explorer\AndroidByread\bin\byreadreader -f f:\explorer\AndroidByread\bin\class.dex -rf F:\explorer\AndroidByread\src
其中f:\explorer\byreadreader.apk為生成的apk ,-z f:\explorer\AndroidByread\bin\byreadreader為資源包,f:\explorer\AndroidByread\bin\class.dex為類檔案包
7使用jdk的jarsigner對未簽名的包進行apk簽名:
use jarsigner
jarsigner -keystore ${keystore} -storepass ${keystore.password} -keypass ${keypass} -signedjar ${signed.apkfile} ${unsigned.apkfile} ${keyalias}
例如:
F:\explorer\android-sdk-windows2.2\tools>jarsigner –keystore f:\explorer\eclipse3.5\bbyread.keystore -storepass byread002 -keypass byread002 -signedjar f:\explorer\byread.apk f:\explorer\byreadreader.apk byread
其中–keystore f:\explorer\eclipse3.5\bbyread.keystore 為金鑰檔案 -storepass byread002為金鑰檔案密碼 byread 為金鑰別名 -keypass byread002為金鑰別名密碼,-signedjar f:\explorer\byread.apk為簽名後生成的apk檔案 f:\explorer\byreadreader.apk為未簽名的檔案
F:\explorer\AndroidByread>F:\explorer\android-sdk-windows2.2\platforms\android-3\tools\aapt.exe package -f -M AndroidManifest.xml -S res -A assets -I F:\explorer\android-sdk-windows2.2\platforms\android-3\android.jar -F bin\byreadreader
將AndroidManifest.xml,res和assets資料夾中的資原始檔打包生成byreadreader,用法參見1
6第六步 生成未簽名的apk安裝檔案:
apkbuilder ${output.apk.file} -u -z ${packagedresource.file} -f ${dex.file} -rf ${source.dir} -rj ${libraries.dir}
例:
F:\explorer\AndroidByread>f:\explorer\android-sdk-windows2.2\tools\apkbuilder.bat f:\explorer\byreadreader.apk –v -u -z f:\explorer\AndroidByread\bin\byreadreader -f f:\explorer\AndroidByread\bin\class.dex -rf F:\explorer\AndroidByread\src
其中f:\explorer\byreadreader.apk為生成的apk ,-z f:\explorer\AndroidByread\bin\byreadreader為資源包,f:\explorer\AndroidByread\bin\class.dex為類檔案包
7使用jdk的jarsigner對未簽名的包進行apk簽名:
use jarsigner
jarsigner -keystore ${keystore} -storepass ${keystore.password} -keypass ${keypass} -signedjar ${signed.apkfile} ${unsigned.apkfile} ${keyalias}
例如:
F:\explorer\android-sdk-windows2.2\tools>jarsigner –keystore f:\explorer\eclipse3.5\bbyread.keystore -storepass byread002 -keypass byread002 -signedjar f:\explorer\byread.apk f:\explorer\byreadreader.apk byread
其中–keystore f:\explorer\eclipse3.5\bbyread.keystore 為金鑰檔案 -storepass byread002為金鑰檔案密碼 byread 為金鑰別名 -keypass byread002為金鑰別名密碼,-signedjar f:\explorer\byread.apk為簽名後生成的apk檔案 f:\explorer\byreadreader.apk為未簽名的檔案