九色国产,午夜在线视频,新黄色网址,九九色综合,天天做夜夜做久久做狠狠,天天躁夜夜躁狠狠躁2021a,久久不卡一区二区三区

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
android使用ANT打包,簽名,混淆

·········10········20········30········40········50········60········70········80········90········100·······110·······120·······130·······140·······150
  1. <?xml version="1.0" encoding="GBK"?>
  2. <!-- 步驟
  3. 1.用aapt生成R.java
  4. 2.JAVAC編譯JAVA文件
  5. 3.批處理生成classes.dex
  6. 4.aapt打包資源
  7. 5.apkbuilder包資源和類文件為APK文件
  8. 6.jarsinger 對APK進(jìn)行簽名-->
  9. <project name="MyJbox2D" default="zipalign" basedir=".">
  10. <property file="local.properties" />
  11. <property name="jbox2dlib" value="D:/workspace/MyJbox2D/lib" />
  12. <!-- 定義自己的輸出目錄 -->
  13. <property name="outdir" value="outdir" />
  14. <property name="out.absolute.dir" location="${outdir}" />
  15. <!-- 定義 R.java 所有目錄 -->
  16. <property name="outdir-gen" value="gen" />
  17. <!-- 讀取目錄 -->
  18. <property name="resource-dir" value="res" />
  19. <property name="asset-dir" value="assets" />
  20. <property name="src-dir" value="src" />
  21. <property name="src-dir-ospath" value="${basedir}/${src-dir}" />
  22. <!-- 輸出目錄 -->
  23. <property name="outdir-classes" value="${outdir}/classes" />
  24. <property name="out.classes.absolute.dir" location="${outdir-classes}" />
  25. <!-- 臨時(shí)類資源文件 -->
  26. <property name="dex-file" value="classes.dex" />
  27. <property name="intermediate-dex" value="${out.absolute.dir}/${dex-file}" />
  28. <!-- 最終生成文件 -->
  29. <property name="out-package" value="${outdir}/${ant.project.name}.apk" />
  30. <!-- 要使用的工具 -->
  31. <property name="aapt" value="${sdk-platform-tools}/aapt.exe" />
  32. <property name="aidl" value="${sdk-platform-tools}/aidl.exe" />
  33. <property name="dx" value="${sdk-platform-tools}/dx.bat" />
  34. <property name="adb" value="${sdk-tools}/adb" />
  35. <property name="apk-builder" value="${sdk-tools}/apkbuilder.bat" />
  36. <property name="android-jar" value="${sdk-platform}/android.jar" />
  37. <!-- 最終生成各種包文件 -->
  38. <property name="resources-package" value="${outdir}/${ant.project.name}" />
  39. <property name="resources-package-ospath" value="${basedir}/${resources-package}" />
  40. <property name="out-unsigned-package" value="${outdir}/${ant.project.name}-unsigned.apk" />
  41. <property name="out-unsigned-package-ospath" value="${basedir}/${out-unsigned-package}" />
  42. <property name="out-signed-package" value="${outdir}/${ant.project.name}-signed.apk" />
  43. <property name="out-signed-package-ospath" value="${basedir}/${out-signed-package}" />
  44. <property name="zipalign-package-ospath" value="${basedir}/${outdir}/${ant.project.name}_release.apk" />
  45. <!--簽名工具-->
  46. <property name="jarsigner" value="${jdk-home}/bin/jarsigner.exe" />
  47. <!--優(yōu)化APK工具-->
  48. <property name="zipalign" value="${sdk-tools}/zipalign.exe" />
  49. <!-- 初始化 -->
  50. <target name="init">
  51. <echo>Creating all output directories </echo>
  52. <delete dir="${outdir}" />
  53. <delete dir="${outdir-classes}" />
  54. <delete dir="${outdir-gen}" />
  55. <mkdir dir="${outdir}" />
  56. <mkdir dir="${outdir-classes}" />
  57. <mkdir dir="${outdir-gen}" />
  58. </target>
  59. <!--步驟 1: aapt生成R.java -->
  60. <target name="resource-src" depends="init">
  61. <echo>Generating R.java...</echo>
  62. <exec executable="${aapt}" failonerror="true">
  63. <arg value="package" />
  64. <arg value="-m" />
  65. <arg value="-J" />
  66. <arg value="${outdir-gen}" />
  67. <arg value="-M" />
  68. <arg value="AndroidManifest.xml" />
  69. <arg value="-S" />
  70. <arg value="${resource-dir}" />
  71. <arg value="-I" />
  72. <arg value="${android-jar}" />
  73. </exec>
  74. </target>
  75. <!-- Generate java classes from .aidl files. -->
  76. <target name="aidl" depends="init">
  77. <echo>Compiling aidl files into Java classes...</echo>
  78. <apply executable="${aidl}" failonerror="true">
  79. <arg value="-p${android-framework}" />
  80. <arg value="-I${src-dir}" />
  81. <fileset dir="${src-dir}">
  82. <include name="**/*.aidl" />
  83. </fileset>
  84. </apply>
  85. </target>
  86. <!-- 步驟 2. 編譯所有class文件. -->
  87. <target name="compile" depends="init, resource-src, aidl">
  88. <unjar src="${jbox2dlib}/jbox2d.jar" mce_src="${jbox2dlib}/jbox2d.jar" dest="${outdir-classes}" />
  89. <javac encoding="GBK" target="1.6" debug="true" extdirs="" srcdir="." destdir="${outdir-classes}" bootclasspath="${android-jar}" />
  90. </target>
  91. <!-- 混淆代碼-->
  92. <target name="proguard" depends="compile">
  93. <jar basedir="${outdir-classes}" destfile="temp.jar" />
  94. <java jar="${proguard-home}/proguard.jar" fork="true" failonerror="true">
  95. <jvmarg value="-Dmaximum.inlined.code.length=32" />
  96. <arg value="-injars temp.jar" />
  97. <arg value="-outjars optimized.jar" />
  98. <arg value="-libraryjars ${android-jar}" />
  99. <arg value="-dontpreverify" />
  100. <arg value="-dontoptimize" />
  101. <arg value="-dontusemixedcaseclassnames" />
  102. <arg value="-repackageclasses ''" />
  103. <arg value="-allowaccessmodification" />
  104. <!-- 要保留自己的主ACTIVITY類 -->
  105. <arg value="-keep public class com.jbox2d.demo.MyActivity" />
  106. <arg value="-optimizationpasses 7" />
  107. <arg value="-verbose" />
  108. <arg value="-dontskipnonpubliclibraryclasses" />
  109. <arg value="-dontskipnonpubliclibraryclassmembers" />
  110. </java>
  111. <delete file="temp.jar" />
  112. <delete dir="${outdir-classes}" />
  113. <mkdir dir="${outdir-classes}" />
  114. <unzip src="optimized.jar" mce_src="optimized.jar" dest="${outdir-classes}" />
  115. <delete file="optimized.jar" />
  116. </target>
  117. <!-- 步驟 3. 轉(zhuǎn)換class文件為dex文件. -->
  118. <target name="dex" depends="proguard">
  119. <echo>Converting compiled files into ${intermediate-dex}... </echo>
  120. <exec executable="${dx}" failonerror="true">
  121. <arg value="--dex" />
  122. <arg value="--output=${intermediate-dex}" />
  123. <arg path="${out.classes.absolute.dir}" />
  124. </exec>
  125. </target>
  126. <!-- 步驟 4. 將資源和清單打包. -->
  127. <target name="package-res-and-assets">
  128. <echo>Packaging resources and assets...</echo>
  129. <exec executable="${aapt}" failonerror="true">
  130. <arg value="package" />
  131. <arg value="-f" />
  132. <arg value="-M" />
  133. <arg value="AndroidManifest.xml" />
  134. <arg value="-S" />
  135. <arg value="${resource-dir}" />
  136. <arg value="-A" />
  137. <arg value="${asset-dir}" />
  138. <arg value="-I" />
  139. <arg value="${android-jar}" />
  140. <arg value="-F" />
  141. <arg value="${resources-package}" />
  142. </exec>
  143. </target>
  144. <!-- 步驟 5. 將打好的包編譯為APK文件. -->
  145. <target name="debug" depends="dex, package-res-and-assets">
  146. <echo>release:Packaging ${out-debug-package-ospath}, and signing it with a debug key...</echo>
  147. <exec executable="${apk-builder}" failonerror="true">
  148. <arg value="${out-unsigned-package-ospath}" />
  149. <arg value="-u" />
  150. <arg value="-z" />
  151. <arg value="${resources-package-ospath}" />
  152. <arg value="-f" />
  153. <arg value="${intermediate-dex}" />
  154. <arg value="-rf" />
  155. <arg value="${src-dir-ospath}" />
  156. </exec>
  157. </target>
  158. <!--步驟 6. 簽名APK文件 -->
  159. <target name="jarsigner" depends="debug">
  160. <echo> jarsigner ${out-signed-package-ospath}</echo>
  161. <exec executable="${jarsigner}" failonerror="true">
  162. <arg value="-verbose" />
  163. <arg value="-storepass" />
  164. <arg value="${keypass}" />
  165. <arg value="-keystore" />
  166. <arg value="${keystore}" />
  167. <arg value="-signedjar" />
  168. <arg value="${out-signed-package-ospath}" />
  169. <arg value="${out-unsigned-package-ospath}" />
  170. <arg value="${key}" />
  171. </exec>
  172. </target>
  173. <!--zipalign優(yōu)化android程序-->
  174. <target name="zipalign" depends="jarsigner">
  175. <echo> zipalign ${zipalign-package-ospath}</echo>
  176. <exec executable="${zipalign}" failonerror="true">
  177. <arg value="-v" />
  178. <arg value="-f" />
  179. <arg value="4" />
  180. <arg value="${out-signed-package-ospath}" />
  181. <arg value="${zipalign-package-ospath}" />
  182. </exec>
  183. </target>
  184. <!-- 安裝到默認(rèn)的手機(jī)或模擬器-->
  185. <target name="install" depends="zipalign">
  186. <echo>Installing ${out-debug-package} onto default emulator...</echo>
  187. <exec executable="${adb}" failonerror="true">
  188. <arg value="install" />
  189. <arg value="${out-signed-package}" />
  190. </exec>
  191. </target>
  192. </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)新聞
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服