九色国产,午夜在线视频,新黄色网址,九九色综合,天天做夜夜做久久做狠狠,天天躁夜夜躁狠狠躁2021a,久久不卡一区二区三区
打開APP
未登錄
開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服
開通VIP
首頁
好書
留言交流
下載APP
聯(lián)系客服
android使用ANT打包,簽名,混淆
w_hf的圖書館
>《Android》
2011.09.26
關(guān)注
view plain
copy to clipboard
print
?
·········10········20········30········40········50········60········70········80········90········100·······110·······120·······130·······140·······150
<?
xml
version
=
"1.0"
encoding
=
"GBK"
?>
<!-- 步驟
1.用aapt生成R.java
2.JAVAC編譯JAVA文件
3.批處理生成classes.dex
4.aapt打包資源
5.apkbuilder包資源和類文件為APK文件
6.jarsinger 對APK進(jìn)行簽名--
>
<
project
name
=
"MyJbox2D"
default
=
"zipalign"
basedir
=
"."
>
<
property
file
=
"local.properties"
/>
<
property
name
=
"jbox2dlib"
value
=
"D:/workspace/MyJbox2D/lib"
/>
<!-- 定義自己的輸出目錄 -->
<
property
name
=
"outdir"
value
=
"outdir"
/>
<
property
name
=
"out.absolute.dir"
location
=
"${outdir}"
/>
<!-- 定義 R.java 所有目錄 -->
<
property
name
=
"outdir-gen"
value
=
"gen"
/>
<!-- 讀取目錄 -->
<
property
name
=
"resource-dir"
value
=
"res"
/>
<
property
name
=
"asset-dir"
value
=
"assets"
/>
<
property
name
=
"src-dir"
value
=
"src"
/>
<
property
name
=
"src-dir-ospath"
value
=
"${basedir}/${src-dir}"
/>
<!-- 輸出目錄 -->
<
property
name
=
"outdir-classes"
value
=
"${outdir}/classes"
/>
<
property
name
=
"out.classes.absolute.dir"
location
=
"${outdir-classes}"
/>
<!-- 臨時(shí)類資源文件 -->
<
property
name
=
"dex-file"
value
=
"classes.dex"
/>
<
property
name
=
"intermediate-dex"
value
=
"${out.absolute.dir}/${dex-file}"
/>
<!-- 最終生成文件 -->
<
property
name
=
"out-package"
value
=
"${outdir}/${ant.project.name}.apk"
/>
<!-- 要使用的工具 -->
<
property
name
=
"aapt"
value
=
"${sdk-platform-tools}/aapt.exe"
/>
<
property
name
=
"aidl"
value
=
"${sdk-platform-tools}/aidl.exe"
/>
<
property
name
=
"dx"
value
=
"${sdk-platform-tools}/dx.bat"
/>
<
property
name
=
"adb"
value
=
"${sdk-tools}/adb"
/>
<
property
name
=
"apk-builder"
value
=
"${sdk-tools}/apkbuilder.bat"
/>
<
property
name
=
"android-jar"
value
=
"${sdk-platform}/android.jar"
/>
<!-- 最終生成各種包文件 -->
<
property
name
=
"resources-package"
value
=
"${outdir}/${ant.project.name}"
/>
<
property
name
=
"resources-package-ospath"
value
=
"${basedir}/${resources-package}"
/>
<
property
name
=
"out-unsigned-package"
value
=
"${outdir}/${ant.project.name}-unsigned.apk"
/>
<
property
name
=
"out-unsigned-package-ospath"
value
=
"${basedir}/${out-unsigned-package}"
/>
<
property
name
=
"out-signed-package"
value
=
"${outdir}/${ant.project.name}-signed.apk"
/>
<
property
name
=
"out-signed-package-ospath"
value
=
"${basedir}/${out-signed-package}"
/>
<
property
name
=
"zipalign-package-ospath"
value
=
"${basedir}/${outdir}/${ant.project.name}_release.apk"
/>
<!--簽名工具-->
<
property
name
=
"jarsigner"
value
=
"${jdk-home}/bin/jarsigner.exe"
/>
<!--優(yōu)化APK工具-->
<
property
name
=
"zipalign"
value
=
"${sdk-tools}/zipalign.exe"
/>
<!-- 初始化 -->
<
target
name
=
"init"
>
<
echo
>
Creating all output directories
</
echo
>
<
delete
dir
=
"${outdir}"
/>
<
delete
dir
=
"${outdir-classes}"
/>
<
delete
dir
=
"${outdir-gen}"
/>
<
mkdir
dir
=
"${outdir}"
/>
<
mkdir
dir
=
"${outdir-classes}"
/>
<
mkdir
dir
=
"${outdir-gen}"
/>
</
target
>
<!--步驟 1: aapt生成R.java -->
<
target
name
=
"resource-src"
depends
=
"init"
>
<
echo
>
Generating R.java...
</
echo
>
<
exec
executable
=
"${aapt}"
failonerror
=
"true"
>
<
arg
value
=
"package"
/>
<
arg
value
=
"-m"
/>
<
arg
value
=
"-J"
/>
<
arg
value
=
"${outdir-gen}"
/>
<
arg
value
=
"-M"
/>
<
arg
value
=
"AndroidManifest.xml"
/>
<
arg
value
=
"-S"
/>
<
arg
value
=
"${resource-dir}"
/>
<
arg
value
=
"-I"
/>
<
arg
value
=
"${android-jar}"
/>
</
exec
>
</
target
>
<!-- Generate java classes from .aidl files. -->
<
target
name
=
"aidl"
depends
=
"init"
>
<
echo
>
Compiling aidl files into Java classes...
</
echo
>
<
apply
executable
=
"${aidl}"
failonerror
=
"true"
>
<
arg
value
=
"-p${android-framework}"
/>
<
arg
value
=
"-I${src-dir}"
/>
<
fileset
dir
=
"${src-dir}"
>
<
include
name
=
"**/*.aidl"
/>
</
fileset
>
</
apply
>
</
target
>
<!-- 步驟 2. 編譯所有class文件. -->
<
target
name
=
"compile"
depends
=
"init, resource-src, aidl"
>
<
unjar
src
=
"${jbox2dlib}/jbox2d.jar"
mce_src
=
"${jbox2dlib}/jbox2d.jar"
dest
=
"${outdir-classes}"
/>
<
javac
encoding
=
"GBK"
target
=
"1.6"
debug
=
"true"
extdirs
=
""
srcdir
=
"."
destdir
=
"${outdir-classes}"
bootclasspath
=
"${android-jar}"
/>
</
target
>
<!-- 混淆代碼-->
<
target
name
=
"proguard"
depends
=
"compile"
>
<
jar
basedir
=
"${outdir-classes}"
destfile
=
"temp.jar"
/>
<
java
jar
=
"${proguard-home}/proguard.jar"
fork
=
"true"
failonerror
=
"true"
>
<
jvmarg
value
=
"-Dmaximum.inlined.code.length=32"
/>
<
arg
value
=
"-injars temp.jar"
/>
<
arg
value
=
"-outjars optimized.jar"
/>
<
arg
value
=
"-libraryjars ${android-jar}"
/>
<
arg
value
=
"-dontpreverify"
/>
<
arg
value
=
"-dontoptimize"
/>
<
arg
value
=
"-dontusemixedcaseclassnames"
/>
<
arg
value
=
"-repackageclasses ''"
/>
<
arg
value
=
"-allowaccessmodification"
/>
<!-- 要保留自己的主ACTIVITY類 -->
<
arg
value
=
"-keep public class com.jbox2d.demo.MyActivity"
/>
<
arg
value
=
"-optimizationpasses 7"
/>
<
arg
value
=
"-verbose"
/>
<
arg
value
=
"-dontskipnonpubliclibraryclasses"
/>
<
arg
value
=
"-dontskipnonpubliclibraryclassmembers"
/>
</
java
>
<
delete
file
=
"temp.jar"
/>
<
delete
dir
=
"${outdir-classes}"
/>
<
mkdir
dir
=
"${outdir-classes}"
/>
<
unzip
src
=
"optimized.jar"
mce_src
=
"optimized.jar"
dest
=
"${outdir-classes}"
/>
<
delete
file
=
"optimized.jar"
/>
</
target
>
<!-- 步驟 3. 轉(zhuǎn)換class文件為dex文件. -->
<
target
name
=
"dex"
depends
=
"proguard"
>
<
echo
>
Converting compiled files into ${intermediate-dex}...
</
echo
>
<
exec
executable
=
"${dx}"
failonerror
=
"true"
>
<
arg
value
=
"--dex"
/>
<
arg
value
=
"--output=${intermediate-dex}"
/>
<
arg
path
=
"${out.classes.absolute.dir}"
/>
</
exec
>
</
target
>
<!-- 步驟 4. 將資源和清單打包. -->
<
target
name
=
"package-res-and-assets"
>
<
echo
>
Packaging resources and assets...
</
echo
>
<
exec
executable
=
"${aapt}"
failonerror
=
"true"
>
<
arg
value
=
"package"
/>
<
arg
value
=
"-f"
/>
<
arg
value
=
"-M"
/>
<
arg
value
=
"AndroidManifest.xml"
/>
<
arg
value
=
"-S"
/>
<
arg
value
=
"${resource-dir}"
/>
<
arg
value
=
"-A"
/>
<
arg
value
=
"${asset-dir}"
/>
<
arg
value
=
"-I"
/>
<
arg
value
=
"${android-jar}"
/>
<
arg
value
=
"-F"
/>
<
arg
value
=
"${resources-package}"
/>
</
exec
>
</
target
>
<!-- 步驟 5. 將打好的包編譯為APK文件. -->
<
target
name
=
"debug"
depends
=
"dex, package-res-and-assets"
>
<
echo
>
release:Packaging ${out-debug-package-ospath}, and signing it with a debug key...
</
echo
>
<
exec
executable
=
"${apk-builder}"
failonerror
=
"true"
>
<
arg
value
=
"${out-unsigned-package-ospath}"
/>
<
arg
value
=
"-u"
/>
<
arg
value
=
"-z"
/>
<
arg
value
=
"${resources-package-ospath}"
/>
<
arg
value
=
"-f"
/>
<
arg
value
=
"${intermediate-dex}"
/>
<
arg
value
=
"-rf"
/>
<
arg
value
=
"${src-dir-ospath}"
/>
</
exec
>
</
target
>
<!--步驟 6. 簽名APK文件 -->
<
target
name
=
"jarsigner"
depends
=
"debug"
>
<
echo
>
jarsigner ${out-signed-package-ospath}
</
echo
>
<
exec
executable
=
"${jarsigner}"
failonerror
=
"true"
>
<
arg
value
=
"-verbose"
/>
<
arg
value
=
"-storepass"
/>
<
arg
value
=
"${keypass}"
/>
<
arg
value
=
"-keystore"
/>
<
arg
value
=
"${keystore}"
/>
<
arg
value
=
"-signedjar"
/>
<
arg
value
=
"${out-signed-package-ospath}"
/>
<
arg
value
=
"${out-unsigned-package-ospath}"
/>
<
arg
value
=
"${key}"
/>
</
exec
>
</
target
>
<!--zipalign優(yōu)化android程序-->
<
target
name
=
"zipalign"
depends
=
"jarsigner"
>
<
echo
>
zipalign ${zipalign-package-ospath}
</
echo
>
<
exec
executable
=
"${zipalign}"
failonerror
=
"true"
>
<
arg
value
=
"-v"
/>
<
arg
value
=
"-f"
/>
<
arg
value
=
"4"
/>
<
arg
value
=
"${out-signed-package-ospath}"
/>
<
arg
value
=
"${zipalign-package-ospath}"
/>
</
exec
>
</
target
>
<!-- 安裝到默認(rèn)的手機(jī)或模擬器-->
<
target
name
=
"install"
depends
=
"zipalign"
>
<
echo
>
Installing ${out-debug-package} onto default emulator...
</
echo
>
<
exec
executable
=
"${adb}"
failonerror
=
"true"
>
<
arg
value
=
"install"
/>
<
arg
value
=
"${out-signed-package}"
/>
</
exec
>
</
target
>
</
project
>
好久沒有寫B(tài)LOG了,哈哈,本人有點(diǎn)小懶加上家里也沒有網(wǎng)絡(luò),昨天學(xué)習(xí)了下ANT打包部署,在網(wǎng)上查了下資料綜合了一下,于是有了
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請
點(diǎn)擊舉報(bào)
。
打開APP,閱讀全文并永久保存
查看更多類似文章
猜你喜歡
類似文章
使用ANT打包Android應(yīng)用
android混淆(Obfuscate)
關(guān)于ant 打包android引入第三方類庫library project的終極解決方案
無所不能的“螞蟻”--Ant(一)(二)(三)(四)
基于Jenkins實(shí)現(xiàn)php項(xiàng)目的自動化測試 打包和自動部署
ant+jmeter+jinkens 持續(xù)集成
更多類似文章 >>
生活服務(wù)
熱點(diǎn)新聞
首頁
萬象
文化
人生
生活
健康
教育
職場
理財(cái)
娛樂
藝術(shù)
上網(wǎng)
留言交流
回頂部
聯(lián)系我們
分享
收藏
點(diǎn)擊這里,查看已保存的文章
導(dǎo)長圖
關(guān)注
一鍵復(fù)制
下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!
聯(lián)系客服
微信登錄中...
請勿關(guān)閉此頁面
先別劃走!
送你5元優(yōu)惠券,購買VIP限時(shí)立減!
5
元
優(yōu)惠券
優(yōu)惠券還有
10:00
過期
馬上使用
×