从摄像网站看须求美高梅娱乐4858.com

前段时间做了多个android的网游项目,今后优化裁减年体育积和防护旁人反编写翻译,必要把编写翻译后.class举行模糊,初始在网上看了有的关于
ProGuard的介绍,基本上都以行使ADT自带的打包方式,那些打包方式太慢了,还要手工业输密码,二个字烦。

眼前浏览了瞬间境内相比较大的多少个录像网站,发以后电击排名榜上名列前矛的全是打着金红擦边球的录象,能够说,公布那一个剧情的逐条都以市面专家。可以规范的把握消费着的思想,合理的给本身的出品稳定。
再者以和录像网站合作的方法也能赚到一些低收入,那一个行为简直是上好的投资。
录像网站,自二〇一八年张玉发布录象以来,就起来在境内网络上起来了,方今早已有几大牌子。近期,国内又出新了和过去的
个人网站热,BBS热,门户热,BLOG热
一样的摄像热,很多录像网站如狼烟一样四起,试图在网上分割天下。互连网的竞争比守旧行业越来越严酷,因为提供的服务很难定量,定性,连能摸一摸的产品都尚未,都以在流量上一决高低。甚至很多流量很高的网络服务却找不到毛利格局,那点是致命的,开小卖部,不是搞慈善,尽管搞慈善也得有支持!摄像网站亦如此,
当下的网络,除了邮电通讯等网络接入商能够海约山盟发展,别的的不都以几年河东,几年河西。我们上网除了要掏网费,还有那么多的须求要那2个网站去满意呢?网络的净利润,差不多离不开广告费那几个事物,包罗大家为之感慨的GOOGLEEATH也是那般。互连网游戏倒是个不等,它的虚拟产品能当实物一样出售,哪个游戏的刀都比你在商城买的王麻子刀要贵很多倍,那是怎么呢?大家能够谈谈以下最底部的东西,那便是:近来存在着八个世界,二个是有大街,有太阳,有战争,有爱,有性的真人真事世界,1个是以互连网为沟通,以服务器,PC等整合的虚构世界。那七个的涉及是:现实世界得以孤立存在,能够不须要网络(您会说,那怎么行,那多滑坡啊“`唯独人类曾经落伍了几百万年了),而近年来的虚拟世界又凭借与实际世界,你说一个服务器给另八个服务器一些电子货币有啥样意义?最终只要不转换到现实货币,它有怎么样价值,固然时期能够抵消帐项(那一点很不难令人误解,那就是电子货币的股票总值,其实没有物质的调换,大家的钞票都以假的“`),不过它只是大家物质供给的一种载体。
大家再看看GOOGLEEath这么些事物,GOOGLE的前程就看它了,什么山头,BBS,BLOG,电子商务,它们再做怎么着吗?从最尾部的看,都以在模拟现实世界罢了,所以在互连网这么些行业,哪个人模仿的越像,哪个人正是可怜,你上BBS,BLOG充其量,也是把本人的日记本复制了一晃,搞到网上去了(而且连自身的高低书法都无法展现),更进一步,有录制网了,你能够录象,自拍(不乏友好做贱本身的情节),把温馨看见的,想说的都能整到网上去了!不过那些照旧比不过互联网游戏,你能够随时在网上换换衣服,不管电脑桌上有没有水,游戏里的您能够先喝一口,望游戏止渴也,正就像大部分游戏迷(没有沉溺的不算)玩游戏的指标一样:找到了八个比现实生活更平添的地点。最终网络游戏的机能是:游戏奴隶们把大把的钱撒到娱乐里面,其实是撒到了娱乐运行商的杜撰帐户里面,然后他们又把钱取出来,买买毫宅等花费一部分,仍可以够持续往游戏之中投资,包罗宣传,开新鸿基土地资金财产图,开新区等等,不问可见仿佛现实社会平等资金循环起来了,它不是回顾的轮回,而是滚雪球似的每到三个地点就再粘一些上来。所以大家看看,搞娱乐的很赚钱,可是那仍然不够眩,因为网络在方今的技术水平下照旧不能够离开实际社会的,你玩游戏得有钱啊(不要点卡的比要点卡的还黑),所以您要在玩耍里面赚钱大概很难,因为很难形成差价交易,就好似你想在LIKE的专卖店上边在做2级代理,还想挣钱一样难,游戏之中没有运费,没有商品消息价值的照猫画虎,而且她最终要转化成人民币,那都使我们拿玩网游赚钱这一个题材不能。网游唯有2个得主,是运维商!所以在”面向大众“
那个难点上,游戏做的不够到位!出了GOOGLEEATH现在,就变了有的,它看掌握了最尾部的东西:互连网须求效法世界,只要把握那其中央就能够最后变成那几个小圈子的霸主,游戏只是给那个(曾经包涵本人)傻子设计的,而GOOGLEEATH却能在虚拟世界中级知识分子足超过八分之四人的供给。大家用网络只是支持现实世界的一种手段,不是都得仰仗它,甚至离不开它!您想想买商品,我们一般都以先在网上查看,去只好明白它的:外观和口碑,仅次2项,质地,重量,气味等诸多我们都不只怕完成人机模拟,充其量就是一段有广告狐疑的摄像。真正要买还得看看实物,至于互联网购买,只是发货地和给付情势,运输格局各异而已。笔者敢说在GOOGLEEATH推出3D模仿的时候,他的主任并不敢妄想人们从此会靠网络实现旅行来放松自身,它冲其量也是让芸芸众生尝尝鲜,先去虚拟的浏览一下,必定电子总计机和切实世界中的这几个化学总计机比起来还要落后不了然多少亿个档次!正如黑客帝国一样,尽管计算机统治了海内外,依然有个西岸存在!

于是乎从头找寻ant+proguard+签名的打包情势,遗憾的是材质不是缺手便是断脚。

好呢,看来得食自个儿了,!@#¥@#!@#!@##¥@#¥!@#@
转眼13日,笔者++,终于把东西搞出来

ps:大家项目还有七个特别需要,要把版本号,推广ID打到包里去,方便做推广什么的。那里能够用replace的措施对string.xml实行修改

好啊,废话不说了,直接上build文件 

 

 

  1. [代码][xml]代码     跳至 [1] [全屏预览]

 

<?xml version=”1.0″ encoding=”UTF-8″?>

<project name=”xiyou_base_” default=”deployableAllDevice”>

<!– proguard4的路径 –>

<property name=”proguard.home”
value=”D:/software/j2me/proguard4.5.1/proguard4.5.1″/>

<!– sdk的路径 –>

<property name=”sdk.dir” value=”E:\dev\android-sdk-windows”/>

<!– 是或不是采取签名 –>

<property name=”has.keystore” value=”true” />

<!– 签名密码 –>

<property name=”has.password” value=”true” />

<!–签名相关的key –>

<property name=”key.alias” value=”key.keystore” />

<property name=”key.store” value=”key.keystore” />

<!– 签名相关的密码 –>

<property name=”key.store.password” value=”xxxx” />

<property name=”key.alias.password” value=”xxxx” />

 

 

<!– 

default.properties 内容

target=android-4

proguard.config=proguard.cfg

 –>

<property file=”default.properties” />

 

<!– Custom Android task to deal with the project target, and import
the

         proper rules.

         This requires ant 1.6.0 or above. –>

<path id=”android.antlibs”>

<pathelement path=”${sdk.dir}/tools/lib/anttasks.jar” />

<pathelement path=”${sdk.dir}/tools/lib/sdklib.jar” />

<pathelement path=”${sdk.dir}/tools/lib/androidprefs.jar” />

</path>

 

<taskdef name=”setup” classname=”com.android.ant.SetupTask”
classpathref=”android.antlibs” />

<setup import=”false” />

 

<!– Custom tasks –>

<taskdef name=”aapt” classname=”com.android.ant.AaptExecLoopTask”
classpathref=”android.antlibs” />

 

<taskdef name=”aidl” classname=”com.android.ant.AidlExecTask”
classpathref=”android.antlibs” />

 

<taskdef name=”apkbuilder” classname=”com.android.ant.ApkBuilderTask”
classpathref=”android.antlibs” />

 

<taskdef name=”xpath” classname=”com.android.ant.XPathTask”
classpathref=”android.antlibs” />

 

<taskdef name=”if” classname=”com.android.ant.IfElseTask”
classpathref=”android.antlibs” />

 

<!– Properties –>

 

<!– Tells adb which device to target. You can change this from the
command line

              by invoking “ant -Dadb.device.arg=-d” for device “ant
-Dadb.device.arg=-e” for

              the emulator. –>

<property name=”adb.device.arg” value=”” />

 

<property name=”android.tools.dir” location=”${sdk.dir}/tools” />

<property name=”android.platform.tools.dir”
location=”${sdk.dir}/platform-tools” />

<!– Name of the application package extracted from manifest file
–>

<xpath input=”AndroidManifest.xml” expression=”/manifest/@package”
output=”manifest.package” />

<!– Value of the hasCode attribute (Application node) extracted from
manifest file –>

<xpath input=”AndroidManifest.xml”
expression=”/manifest/application/@android:hasCode”
output=”manifest.hasCode” default=”true” />

 

<!– 源文件及财富路径 –>

<property name=”source.dir” value=”src” />

<property name=”source.absolute.dir” location=”${source.dir}” />

<property name=”gen.dir” value=”gen” />

<property name=”gen.absolute.dir” location=”${gen.dir}” />

<property name=”resource.dir” value=”res” />

<property name=”resource.absolute.dir” location=”${resource.dir}”
/>

<property name=”asset.dir” value=”assets” />

<property name=”asset.absolute.dir” location=”${asset.dir}” />

 

<!– Directory for the third party java libraries –>

<property name=”jar.libs.dir” value=”libs” />

<property name=”jar.libs.absolute.dir” location=”${jar.libs.dir}”
/>

<!– create a path with all the jar files, from the main project and
the

              libraries –>

<path id=”jar.libs.ref”>

<fileset dir=”${jar.libs.absolute.dir}” includes=”*.jar” />

<path refid=”project.libraries.jars” />

</path>

 

<!– Directory for the native libraries –>

<property name=”native.libs.dir” value=”libs” />

<property name=”native.libs.absolute.dir”
location=”${native.libs.dir}” />

 

<!– 输出路径 –>

<property name=”out.dir” value=”out” />

<property name=”out.absolute.dir” location=”${out.dir}” />

<property name=”out.classes.dir” value=”${out.absolute.dir}/classes”
/>

<property name=”out.classes.absolute.dir”
location=”${out.classes.dir}” />

 

<!– Intermediate files –>

<property name=”dex.file.name” value=”classes.dex” />

<property name=”intermediate.dex.file”
location=”${out.absolute.dir}/${dex.file.name}” />

<property name=”resource.package.file.name”
value=”${ant.project.name}.ap_” />

 

<!– The final package file to generate

              These can be overridden by setting them earlier to

              different values –>

<property name=”out.debug.unaligned.file”
location=”${out.absolute.dir}/${ant.project.name}-debug-unaligned.apk”
/>

<property name=”out.debug.file”
location=”${out.absolute.dir}/${ant.project.name}-debug.apk” />

 

<property name=”out.unsigned.file.name”
value=”${ant.project.name}-unsigned.apk” />

<property name=”out.unsigned.file”
location=”${out.absolute.dir}/${out.unsigned.file.name}” />

 

<property name=”out.unaligned.file.name”
value=”${ant.project.name}-unaligned.apk” />

<property name=”out.unaligned.file”
location=”${out.absolute.dir}/${out.unaligned.file.name}” />

 

<property name=”out.release.file.name”
value=”${ant.project.name}-release.apk” />

<property name=”out.release.file”
location=”${out.absolute.dir}/${out.release.file.name}” />

 

<property name=”proguard.enabled” value=”true” />

<property name=”android-jar”
value=”${sdk.dir}/platforms/${target}/android.jar” />

 

<!– set some properties used for filtering/override. If those
weren’t defined

              before, then this will create them with empty values,
which are then ignored

              by the custom tasks receiving them. –>

<property name=”version.code” value=”” />

<property name=”aapt.resource.filter” value=”” />

<property name=”filter.abi” value=”” />

 

<!– java源文件编码,编写翻译的靶子平台,为1.5 or 1.6都能够 –>

<property name=”java.encoding” value=”UTF-8″ />

<property name=”java.target” value=”1.5″ />

<property name=”java.source” value=”1.5″ />

 

<!– Verbosity –>

<property name=”verbose” value=”false” />

 

<!– Verbosity –>

<property name=”verbose” value=”false” />

<!– This is needed by emma as it uses multilevel verbosity instead
of simple ‘true’ or ‘false’

              The property ‘verbosity’ is not user configurable and
depends exclusively on ‘verbose’

              value.–>

<condition property=”verbosity” value=”verbose” else=”quiet”>

<istrue value=”${verbose}” />

</condition>

<!– This is needed to switch verbosity of zipalign. Depends
exclusively on ‘verbose’

              –>

<condition property=”v.option” value=”-v” else=””>

<istrue value=”${verbose}” />

</condition>

<!– This is needed to switch verbosity of dx. Depends exclusively on
‘verbose’ –>

<condition property=”verbose.option” value=”–verbose” else=””>

<istrue value=”${verbose}” />

</condition>

 

<!– properties for signing in release mode –>

<condition property=”has.keystore” value=”true”>

<and>

<isset property=”key.store” />

<length string=”${key.store}” when=”greater” length=”0″ />

<isset property=”key.alias” />

</and>

</condition>

<condition property=”has.password” value=”passwordxxxxx”>

<and>

<isset property=”has.keystore” />

<isset property=”key.store.password” />

<isset property=”key.alias.password” />

</and>

</condition>

 

<!– Tools –>

<condition property=”exe” value=”.exe” else=””>

<os family=”windows” />

</condition>

<property name=”adb”
location=”${android.platform.tools.dir}/adb${exe}” />

<property name=”zipalign”
location=”${android.tools.dir}/zipalign${exe}” />

 

<!– Emma configuration –>

<property name=”emma.dir” value=”${sdk.dir}/tools/lib” />

<path id=”emma.lib”>

<pathelement location=”${emma.dir}/emma.jar” />

<pathelement location=”${emma.dir}/emma_ant.jar” />

</path>

<taskdef resource=”emma_ant.properties” classpathref=”emma.lib”
/>

<!– End of emma configuration –>

 

<!– Macros –>

 

<!– Configurable macro, which allows to pass as parameters output
directory,

              output dex filename and external libraries to dex
(optional) –>

<macrodef name=”dex-helper”>

<element name=”external-libs” optional=”yes” />

<element name=”extra-parameters” optional=”yes” />

<sequential>

<!– sets the primary input for dex. If a pre-dex task sets it to

                        something else this has no effect –>

<property name=”out.dex.input.absolute.dir”
value=”${out.classes.absolute.dir}” />

 

<!– set the secondary dx input: the project (and library) jar files

                        If a pre-dex task sets it to something else this
has no effect –>

<if>

<condition>

<isreference refid=”out.dex.jar.input.ref” />

</condition>

<else>

<path id=”out.dex.jar.input.ref”>

<path refid=”jar.libs.ref” />

</path>

</else>

</if>

 

<echo>Converting compiled files and external libraries into
${intermediate.dex.file}…</echo>

<apply executable=”${dx}” failonerror=”true” parallel=”true”>

<arg value=”–dex” />

<arg value=”–output=${intermediate.dex.file}” />

<extra-parameters />

<arg line=”${verbose.option}” />

<arg path=”${out.dex.input.absolute.dir}” />

<path refid=”out.dex.jar.input.ref” />

<external-libs />

</apply>

</sequential>

</macrodef>

 

<!– This is macro that enable passing variable list of external jar
files to ApkBuilder

              Example of use:

              <package-helper output.filepath=”/path/to/foo.apk”>

                  <extra-jars>

                     <jarfolder path=”my_jars” />

                     <jarfile path=”foo/bar.jar” />

                     <jarfolder path=”your_jars” />

                  </extra-jars>

              </package-helper> –>

<macrodef name=”package-helper”>

<attribute name=”output.filepath” />

<element name=”extra-jars” optional=”yes” />

<sequential>

<apkbuilder outfolder=”${out.absolute.dir}”
resourcefile=”${resource.package.file.name}”
apkfilepath=”@{output.filepath}”
debugpackaging=”${build.packaging.debug}”
debugsigning=”${build.signing.debug}” abifilter=”${filter.abi}”
verbose=”${verbose}” hascode=”${manifest.hasCode}”>

<dex path=”${intermediate.dex.file}” />

<sourcefolder path=”${source.absolute.dir}” />

<sourcefolder refid=”project.libraries.src” />

<jarfolder path=”${jar.libs.absolute.dir}” />

<jarfolder refid=”project.libraries.libs” />

<nativefolder path=”${native.libs.absolute.dir}” />

<nativefolder refid=”project.libraries.libs” />

<extra-jars />

</apkbuilder>

</sequential>

</macrodef>

 

<!– This is macro which zipaligns in.package and outputs it to
out.package. Used by targets

              debug, -debug-with-emma and release.–>

<macrodef name=”zipalign-helper”>

<attribute name=”in.package” />

<attribute name=”out.package” />

<sequential>

<echo>Running zip align on final apk…</echo>

<exec executable=”${zipalign}” failonerror=”true”>

<arg line=”${v.option}” />

<arg value=”-f” />

<arg value=”4″ />

<arg path=”@{in.package}” />

<arg path=”@{out.package}” />

</exec>

</sequential>

</macrodef>

 

<!– This is macro used only for sharing code among two targets,
-install and

              -install-with-emma which do exactly the same but differ in
dependencies –>

<macrodef name=”install-helper”>

<sequential>

<echo>Installing ${out.debug.file} onto default emulator or
device…</echo>

<exec executable=”${adb}” failonerror=”true”>

<arg line=”${adb.device.arg}” />

<arg value=”install” />

<arg value=”-r” />

<arg path=”${out.debug.file}” />

</exec>

</sequential>

</macrodef>

 

<!– Rules –>

 

<!– Creates the output directories if they don’t exist yet. –>

<target name=”-dirs”>

<echo>Creating output directories if needed…</echo>

<mkdir dir=”${resource.absolute.dir}” />

<mkdir dir=”${jar.libs.absolute.dir}” />

<mkdir dir=”${out.absolute.dir}” />

<if condition=”${manifest.hasCode}”>

<then>

<mkdir dir=”${gen.absolute.dir}” />

<mkdir dir=”${out.classes.absolute.dir}” />

</then>

</if>

 

 

 

</target>

 

<!– empty default pre-build target. Create a similar target in

              your build.xml and it’ll be called instead of this one.
–>

<target name=”-pre-build” />

 

<!– Generates the R.java file for this project’s resources. –>

<target name=”-resource-src” depends=”-dirs, -pre-build”>

<if condition=”${manifest.hasCode}”>

<then>

<echo>Generating R.java / Manifest.java from the
resources…</echo>

<aapt executable=”${aapt}” command=”package” verbose=”${verbose}”
manifest=”AndroidManifest.xml” androidjar=”${android.jar}”
rfolder=”${gen.absolute.dir}”>

<res path=”${resource.absolute.dir}” />

</aapt>

</then>

<else>

<echo>hasCode = false. Skipping…</echo>

</else>

</if>

</target>

 

<!– Generates java classes from .aidl files. –>

<target name=”-aidl” depends=”-dirs”>

<if condition=”${manifest.hasCode}”>

<then>

<echo>Compiling aidl files into Java classes…</echo>

<aidl executable=”${aidl}” framework=”${android.aidl}”
genFolder=”${gen.absolute.dir}”>

<source path=”${source.absolute.dir}” />

<source refid=”project.libraries.src” />

</aidl>

</then>

<else>

<echo>hasCode = false. Skipping…</echo>

</else>

</if>

</target>

 

<!– empty default pre-compile target. Create a similar target in

              your build.xml and it’ll be called instead of this one.
–>

<target name=”-pre-compile” />

 

<!– Compiles this project’s .java files into .class files. –>

<target name=”compile” depends=”-resource-src, -aidl, -pre-compile”
description=”Compiles project’s .java files into .class files”>

<if condition=”${manifest.hasCode}”>

<then>

<!– If android rules are used for a test project, its classpath
should include

                             tested project’s location –>

<condition property=”extensible.classpath”
value=”${tested.project.absolute.dir}/${out.dir}/classes” else=”.”>

<isset property=”tested.project.absolute.dir” />

</condition>

<condition property=”extensible.libs.classpath”
value=”${tested.project.absolute.dir}/libs” else=”${jar.libs.dir}”>

<isset property=”tested.project.absolute.dir” />

</condition>

<javac encoding=”${java.encoding}” source=”${java.source}”
target=”${java.target}” debug=”true” extdirs=””
destdir=”${out.classes.absolute.dir}”
bootclasspathref=”android.target.classpath” verbose=”${verbose}”
classpath=”${extensible.classpath}” classpathref=”jar.libs.ref”>

<src path=”${source.absolute.dir}” />

<src path=”${gen.absolute.dir}” />

<src refid=”project.libraries.src” />

<classpath>

<fileset dir=”${extensible.libs.classpath}” includes=”*.jar” />

</classpath>

</javac>

</then>

<else>

<echo>hasCode = false. Skipping…</echo>

</else>

</if>

</target>

 

<!– empty default post-compile target. Create a similar target in

              your build.xml and it’ll be called instead of this one.
–>

<target name=”-post-compile” />

 

<!– Obfuscate target

             This is only active in release builds when proguard.config
is defined

             in default.properties.

 

             To replace Proguard with a different obfuscation engine:

             Override the following targets in your build.xml, before
the call to <setup>

                 -release-obfuscation-check

                     Check whether obfuscation should happen, and put
the result in a property.

                 -debug-obfuscation-check

                     Obfuscation should not happen. Set the same
property to false.

                 -obfuscate

                     ** Make sure unless=”do.not.compile” is used in
the target definition **

                     check if the property set in
-debug/release-obfuscation-check is set to true.

                     If true:

                         Perform obfuscation

                         Set property out.dex.input.absolute.dir to be
the output of the obfuscation

         –>

<target name=”-obfuscate” unless=”do.not.compile”>

<if condition=”${proguard.enabled}”>

<then>

<property name=”obfuscate.absolute.dir”
location=”${out.absolute.dir}/proguard” />

<property name=”preobfuscate.jar.file”
value=”${obfuscate.absolute.dir}/original.jar” />

<property name=”obfuscated.jar.file”
value=”${obfuscate.absolute.dir}/obfuscated.jar” />

<!– input for dex will be proguard’s output –>

<property name=”out.dex.input.absolute.dir”
value=”${obfuscated.jar.file}” />

 

<!– Add Proguard Tasks –>

<property name=”proguard.jar”
location=”${proguard.home}/lib/proguard.jar” />

<taskdef name=”proguard” classname=”proguard.ant.ProGuardTask”
classpath=”${proguard.jar}” />

 

<!– Set the android classpath Path object into a single property.
It’ll be

                             all the jar files separated by a platform
path-separator.

                        –>

<property name=”android.libraryjars” refid=”android.target.classpath”
/>

<!– Build a path object with all the jar files that must be
obfuscated.

                             This include the project compiled source
code and any 3rd party jar

                             files. –>

<path id=”project.jars.ref”>

<pathelement location=”${preobfuscate.jar.file}” />

<path refid=”jar.libs.ref” />

</path>

<!– Set the project jar files Path object into a single property.
It’ll be

                             all the jar files separated by a platform
path-separator.

                        –>

<property name=”project.jars” refid=”project.jars.ref” />

 

<mkdir dir=”${obfuscate.absolute.dir}” />

<delete file=”${preobfuscate.jar.file}” />

<delete file=”${obfuscated.jar.file}” />

<jar basedir=”${out.classes.dir}” destfile=”${preobfuscate.jar.file}”
/>

<!– 混淆相关参数 –>

<proguard>

                    -optimizationpasses 5

                    -dontusemixedcaseclassnames

                    -dontskipnonpubliclibraryclasses

                    -dontpreverify

                    -verbose

                -repackageclasses

                -allowaccessmodification

                    -optimizations
!code/simplification/arithmetic,!field/*,!class/merging/*

 

                    -keep public class * extends android.app.Activity

                    -keep public class * extends
android.app.Application

                    -keep public class * extends android.app.Service

                    -keep public class * extends
android.content.BroadcastReceiver

                    -keep public class * extends
android.content.ContentProvider

                    -keep public class
com.android.vending.licensing.ILicensingService

                    -injars ${project.jars}

                    -outjars ${obfuscated.jar.file}

                    -libraryjars ${android.libraryjars}

                </proguard>

</then>

</if>

</target>

 

<target name=”pre” depends=”-obfuscate”>

</target>

 

<!– Converts this project’s .class files into .dex files –>

<!–<target name=”-dex” depends=”compile, -post-compile,
-obfuscate” unless=”do.not.compile”>–>

<target name=”-dex” depends=”compile, -post-compile, optimize”
unless=”do.not.compile”>

<if condition=”${manifest.hasCode}”>

<then>

<dex-helper />

</then>

<else>

<echo>hasCode = false. Skipping…</echo>

</else>

</if>

</target>

 

<target name=”optimize” depends=”compile,-obfuscate”>

<if condition=”${proguard.enabled}”>

<then>

<mkdir dir=”${out.dir}/out/class” />

<!– 创制文件夹–>

<!–别人的<jar basedir=”${out-folder}”
destfile=”temp.jar”/>–>

<property name=”proguard-jar”
value=”${proguard.home}/lib/proguard.jar” />

<java jar=”${proguard-jar}” fork=”true” failonerror=”true”>

<jvmarg value=”-Dmaximum.inlined.code.length=32″ />

<arg value=”-injars ${out.dir}/classes” />

<!– 原来的类公事,使用Bin/classes下的–>

<arg value=”-outjars ${out.dir}/out/classes” />

<!– 生成的混淆Class地点–>

<arg value=”-libraryjars ${android-jar}” />

<!–

                    <arg value=” -libraryjars
${library-jar}/some_lib_used.jar”/>

                    –>

<arg value=”-keep public class * extends android.app.Activity” />

<arg value=”-keep public class * extends android.app.Service” />

<arg value=”-keep public class * extends
android.content.BroadcastReceiver” />

<arg value=”-keep public class * extends
android.content.ContentProvider” />

<arg value=”-keep public class * extends android.view.View” />

<arg value=”-dontwarn” />

<arg value=”-dontpreverify” />

<arg value=”-optimizationpasses 7″ />

<arg value=”-dontusemixedcaseclassnames” />

<arg value=”-dontskipnonpubliclibraryclasses” />

<arg value=”-repackageclasses” />

<arg value=”-allowaccessmodification” />

<!–<arg value=”-dontskipnonpubliclibraryclassmembers”/>–>

</java>

<!–那个是本来的Jar<delete file=”temp.jar”/>–>

<!–<delete dir=”${out-folder}”/>–>

<!–<mkdir dir=”${out-folder}”/>

               <unzip src=”optimized.jar” dest=”${out-folder}”/>

               <delete file=”optimized.jar”/>–>

</then>

</if>

</target>

 

<!– Puts the project’s resources into the output package file

              This actually can create multiple resource package in case

              Some custom apk with specific configuration have been

              declared in default.properties.

              –>

<target name=”-package-resources”>

<echo>Packaging resources</echo>

<aapt executable=”${aapt}” command=”package”
versioncode=”${version.code}” debug=”${build.packaging.debug}”
manifest=”AndroidManifest.xml” assets=”${asset.absolute.dir}”
androidjar=”${android.jar}” apkfolder=”${out.absolute.dir}”
resourcefilename=”${resource.package.file.name}”
resourcefilter=”${aapt.resource.filter}”>

<res path=”${resource.absolute.dir}” />

<!– <nocompress /> forces no compression on any files in
assets or res/raw –>

<!– <nocompress extension=”xml” /> forces no compression on
specific file extensions in assets and res/raw –>

</aapt>

 

</target>

<!– Packages the application and sign it with a debug key. –>

<target name=”-package-debug-sign” depends=”-dex,
-package-resources”>

<package-helper output.filepath=”${out.debug.unaligned.file}” />

</target>

 

<!– Packages the application without signing it. –>

<target name=”-package-release” depends=”-dex,
-package-resources”>

<package-helper output.filepath=”${out.unsigned.file}” />

</target>

 

<target name=”-compile-tested-if-test” if=”tested.project.dir”
unless=”do.not.compile.again”>

<subant target=”compile”>

<fileset dir=”${tested.project.absolute.dir}” includes=”build.xml”
/>

</subant>

</target>

 

<target name=”-debug-obfuscation-check”>

<!– proguard is never enabled in debug mode –>

<property name=”proguard.enabled” value=”true” />

</target>

 

<target name=”-set-debug-mode” depends=”-debug-obfuscation-check”>

<!– property only set in debug mode.

                   Useful for if/unless attributes in target node

                   when using Ant before 1.8 –>

<property name=”build.mode.debug” value=”true” />

 

<!– whether the build is a debug build. always set. –>

<property name=”build.packaging.debug” value=”true” />

 

<!– signing mode: debug –>

<property name=”build.signing.debug” value=”true” />

 

</target>

 

<!– Builds debug output package, provided all the necessary files
are already dexed –>

<target name=”debug” depends=”-set-debug-mode,
-compile-tested-if-test, -package-debug-sign” description=”Builds the
application and signs it with a debug key.”>

<zipalign-helper in.package=”${out.debug.unaligned.file}”
out.package=”${out.debug.file}” />

<echo>Debug Package: ${out.debug.file}</echo>

</target>

 

<!– called through target ‘release’. Only executed if the keystore
and

              key alias are known but not their password. –>

<target name=”-release-prompt-for-password” if=”has.keystore”
unless=”has.password”>

<!– Gets passwords –>

<echo>Gets passwords ${has.keystore} ${has.password}</echo>

<input message=”Please enter keystore password (store:${key.store}):”
addproperty=”key.store.password” defaultvalue=”5201314..” />

<input message=”Please enter password for alias ‘${key.alias}’:”
addproperty=”key.alias.password” defaultvalue=”5201314..” />

</target>

 

<!– called through target ‘release’. Only executed if there’s no

              keystore/key alias set –>

<target name=”-release-nosign” unless=”has.keystore”>

<echo>No key.store and key.alias properties found in
build.properties.</echo>

<echo>Please sign ${out.unsigned.file} manually</echo>

<echo>and run zipalign from the Android SDK tools.</echo>

</target>

 

<target name=”-release-obfuscation-check”>

<condition property=”proguard.enabled” value=”true” else=”false”>

<and>

<isset property=”build.mode.release” />

<isset property=”proguard.config” />

</and>

</condition>

<if condition=”${proguard.enabled}”>

<then>

<!– Secondary dx input (jar files) is empty since all the

                             jar files will be in the obfuscated jar
–>

<path id=”out.dex.jar.input.ref” />

</then>

</if>

</target>

 

<target name=”-set-release-mode”>

<!– release mode is only valid if the manifest does not explicitly

                   set debuggable to true. default is false.

                   We actually store build.packaging.debug, not
build.release –>

<xpath input=”AndroidManifest.xml”
expression=”/manifest/application/@android:debuggable”
output=”build.packaging.debug” default=”false” />

 

<!– signing mode: release –>

<property name=”build.signing.debug” value=”false” />

 

<if condition=”${build.packaging.debug}”>

<then>

<echo>*************************************************</echo>

<echo>**** Android Manifest has debuggable=true
****</echo>

<echo>**** Doing DEBUG packaging with RELEASE keys
****</echo>

<echo>*************************************************</echo>

</then>

<else>

<!– property only set in release mode.

                             Useful for if/unless attributes in target
node

                             when using Ant before 1.8 –>

<property name=”build.mode.release” value=”true” />

</else>

</if>

</target>

 

<!– This runs -package-release and -release-nosign first and then
runs

              only if release-sign is true (set in -release-check,

              called by -release-no-sign)–>

<target name=”release” depends=”-set-release-mode,
-release-obfuscation-check, -package-release,
-release-prompt-for-password, -release-nosign” if=”has.keystore”
description=”Builds the application. The generated apk file must be
signed before

                           it is published.”>

<!– Signs the APK –>

<echo>Signing final apk…</echo>

<signjar jar=”${out.unsigned.file}” signedjar=”${out.unaligned.file}”
keystore=”${key.store}” storepass=”${key.store.password}”
alias=”${key.alias}” keypass=”${key.alias.password}”
verbose=”${verbose}” />

 

<!– Zip aligns the APK –>

<zipalign-helper in.package=”${out.unaligned.file}”
out.package=”${out.release.file}” />

<echo>Release Package: ${out.release.file}</echo>

 

 

</target>

<target name=”clean” description=”Removes output files created by
other targets.”>

<delete dir=”${out.absolute.dir}” verbose=”${verbose}” />

<delete dir=”${gen.absolute.dir}” verbose=”${verbose}” />

</target>

<target name=”deployableAllDevice” description=”build all device
packet”>

<!–
uid和sdk都以自定义参数,可有可无,有多小个包要打,就在那边copy多小行,修改相关参数,传入到程序里即可
–>

<antcall target=”release” inheritAll=”true”><param name=”uid”
value=”100″ /><param name=”sdk” value=”91″ /></antcall>

<antcall target=”release” inheritAll=”true”><param name=”uid”
value=”101″ /><param name=”sdk” value=”90″ /></antcall>

 

</target>

</project>

发表评论

电子邮件地址不会被公开。 必填项已用*标注