- 浏览: 929058 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
itzhongyuan:
java Random类详解 -
david_je:
你好,我看到你在C里面回调JAVA里面的方法是在native里 ...
Android NDK开发(1)----- Java与C互相调用实例详解 -
fykyx521:
请求锁是在 oncreate 释放实在ondestroy?? ...
Android如何保持程序一直运行 -
aduo_vip:
不错,总结得好!
Android读取assets目录下的资源 -
f839903061:
给的网址很给力哦!
Android 4.0.1 源码下载,编译和运行
此脚本用于进行自动编译用户需要的APK安装包,使用时候,请将签名用的*.keystore放在和build.xml同一目录,并命名为android.keystore,(如想更改,请在build.xml 中的jarsigner target进行更改)
build.properties
Java代码
android.tools=${sdk.folder}tools
android_version=2.1
apk.sdk.home=D/:/androidsdktools/android-sdk_r04-windows/android-sdk-windows/
apk.tools=${apk.sdk.home}tools/
application.package=com.test.testname
bin.dir=${jde.home}bin
app.name=NewAndroid
app.source.path=G/:/test/
jdk.home=C/:/Java_1.6_U18/jdk1.6.0_18/
output.dir=../outputDir
password=123456
sdk.folder=D/:/androidsdktools/android-sdk_r04-windows/android-sdk-windows/platforms/android-2.0.1/
temp.dir=127980239039628
[java] view plaincopy
android.tools=${sdk.folder}tools
android_version=2.1
apk.sdk.home=D/:/androidsdktools/android-sdk_r04-windows/android-sdk-windows/
apk.tools=${apk.sdk.home}tools/
application.package=com.test.testname
bin.dir=${jde.home}bin
app.name=NewAndroid
app.source.path=G/:/test/
jdk.home=C/:/Java_1.6_U18/jdk1.6.0_18/
output.dir=../outputDir
password=123456
sdk.folder=D/:/androidsdktools/android-sdk_r04-windows/android-sdk-windows/platforms/android-2.0.1/
temp.dir=127980239039628
Build.xml
Xml代码
<?xml version="1.0" encoding="UTF-8"?>
<project name="Test" default="debug" basedir=".">
<property file="build.properties">
</property>
<!-- The intermediates directory -->
<!-- Eclipse uses "bin" for its own output, so we do the same. -->
<property name="outdir" value="bin" />
<!-- ************************************************************************************* -->
<!-- No user servicable parts below. -->
<property name="android-framework" value="${sdk.folder}/framework.aidl" />
<!-- Input directories -->
<property name="resource-dir" value="res" />
<property name="asset-dir" value="assets" />
<property name="srcdir" value="src" />
<condition property="srcdir-ospath" value="${basedir}/${srcdir}" else="${basedir}/${srcdir}">
<os family="windows" />
</condition>
<property name="external-libs" value="libs" />
<condition property="external-libs-ospath" value="${basedir}/${external-libs}" else="${basedir}/${external-libs}">
<os family="windows" />
</condition>
<!-- Output directories -->
<property name="outdir-classes" value="${outdir}/classes" />
<condition property="outdir-classes-ospath" value="${basedir}/${outdir-classes}" else="${basedir}/${outdir-classes}">
<os family="windows" />
</condition>
<condition property="zipalign-package-ospath" value="${basedir}/${output.dir}/${app.name}_for_android_${android_version}_${temp.dir}.apk" else="${basedir}/${output.dir}">
<os family="windows" />
</condition>
<!-- Create R.java in the source directory -->
<property name="outdir-r" value="src" />
<!-- Intermediate files -->
<property name="dex-file" value="classes.dex" />
<property name="intermediate-dex" value="${outdir}/${dex-file}" />
<condition property="intermediate-dex-ospath" value="${basedir}/${intermediate-dex}" else="${basedir}/${intermediate-dex}">
<os family="windows" />
</condition>
<!-- The final package file to generate -->
<property name="resources-package" value="${outdir}/${ant.project.name}.ap_" />
<condition property="resources-package-ospath" value="${basedir}/${resources-package}" else="${basedir}/${resources-package}">
<os family="windows" />
</condition>
<property name="out-debug-package" value="${outdir}/${ant.project.name}-debug.apk" />
<condition property="out-debug-package-ospath" value="${basedir}/${out-debug-package}" else="${basedir}/${out-debug-package}">
<os family="windows" />
</condition>
<property name="out-unsigned-package" value="${outdir}/${ant.project.name}-unsigned.apk" />
<property name="out-signed-package" value="${outdir}/${ant.project.name}-signed.apk" />
<condition property="out-unsigned-package-ospath" value="${basedir}/${out-unsigned-package}" else="${basedir}/${out-unsigned-package}">
<os family="windows" />
</condition>
<condition property="out-signed-package-ospath" value="${basedir}/${out-signed-package}" else="${basedir}/${out-signed-package}">
<os family="windows" />
</condition>
<!-- Tools -->
<condition property="aapt" value="${android.tools}/aapt.exe" else="${android.tools}/aapt">
<os family="windows" />
</condition>
<condition property="zipalign" value="${apk.tools}/zipalign.exe" else="${apk.tools}/zipalign">
<os family="windows" />
</condition>
<condition property="jarsigner" value="${jdk.home}/bin/jarsigner.exe" else="${jdk.home}/bin/jarsigner">
<os family="windows" />
</condition>
<condition property="aidl" value="${android.tools}/aidl.exe" else="${android.tools}/aidl">
<os family="windows" />
</condition>
<condition property="adb" value="${apk.tools}/adb.exe" else="${apk.tools}/adb">
<os family="windows" />
</condition>
<condition property="dx" value="${android.tools}/dx.bat" else="${android.tools}/dx">
<os family="windows" />
</condition>
<condition property="apk-builder" value="${apk.tools}/apkbuilder.bat" else="${apk.tools}/apkbuilder">
<os family="windows" />
</condition>
<property name="android-jar" value="${sdk.folder}/android.jar" />
<!-- Rules -->
<!-- Create the output directories if they don't exist yet. -->
<target name="dirs" depends="init">
<echo>Creating output directories if needed...</echo>
<mkdir dir="${outdir}" />
<mkdir dir="${outdir-classes}" />
</target>
<!-- Generate the R.java file for this project's resources. -->
<target name="resource-src" depends="dirs">
<echo>Generating R.java / Manifest.java from the resources...</echo>
<exec executable="${aapt}" failonerror="true">
<arg value="package" />
<arg value="-m" />
<arg value="-J" />
<arg value="${outdir-r}" />
<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="dirs">
<echo>Compiling aidl files into Java classes...</echo>
<apply executable="${aidl}" failonerror="true">
<arg value="-p${android-framework}" />
<arg value="-I${srcdir}" />
<fileset dir="${srcdir}">
<include name="**/*.aidl" />
</fileset>
</apply>
</target>
<!-- Compile this project's .java files into .class files. -->
<target name="compile" depends="dirs, resource-src, aidl">
<javac encoding="ascii" target="1.5" debug="true" extdirs="" srcdir="." destdir="${outdir-classes}" bootclasspath="${android-jar}">
<classpath>
<fileset dir="${external-libs}" includes="*.jar" />
</classpath>
</javac>
</target>
<!-- Convert this project's .class files into .dex files. -->
<target name="dex" depends="compile">
<echo>Converting compiled files and external libraries into ${outdir}/${dex-file}...</echo>
<apply executable="${dx}" failonerror="true" parallel="true">
<arg value="--dex" />
<script src="/javascripts/tinymce/themes/advanced/langs/zh.js" type="text/javascript"><!--mce:0--></script><script src="/javascripts/tinymce/plugins/javaeye/langs/zh.js" type="text/javascript"><!--mce:1--></script> <arg value="--output=${intermediate-dex-ospath}" />
<arg path="${outdir-classes-ospath}" />
<fileset dir="${external-libs}" includes="*.jar" />
</apply>
</target>
<!-- Put the project's resources into the output package file. -->
<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>
<!-- Same as package-res-and-assets, but without "-A ${asset-dir}" -->
<target name="package-res-no-assets">
<echo>Packaging resources...</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}" />
<!-- No assets directory -->
<arg value="-I" />
<arg value="${android-jar}" />
<arg value="-F" />
<arg value="${resources-package}" />
</exec>
</target>
<!-- Invoke the proper target depending on whether or not
an assets directory is present. -->
<!-- TODO: find a nicer way to include the "-A ${asset-dir}" argument
only when the assets dir exists. -->
<target name="package-res">
<available file="${asset-dir}" type="dir" property="res-target" value="and-assets" />
<property name="res-target" value="no-assets" />
<antcall target="package-res-${res-target}" />
</target>
<!-- Package the application and sign it with a debug key.
This is the default target when building. It is used for debug. -->
<target name="debug" depends="dex, package-res">
<echo>Packaging ${out-debug-package}, and signing it with a debug key...</echo>
<exec executable="${apk-builder}" failonerror="true">
<arg value="${out-debug-package-ospath}" />
<arg value="-z" />
<arg value="${resources-package-ospath}" />
<arg value="-f" />
<arg value="${intermediate-dex-ospath}" />
<arg value="-rf" />
<arg value="${srcdir-ospath}" />
<arg value="-rj" />
<arg value="${external-libs-ospath}" />
</exec>
</target>
<!-- Package the application without signing it.
This allows for the application to be signed later with an official publishing key. -->
<target name="release" depends="dex, package-res">
<echo>Packaging ${out-unsigned-package} for release...</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-ospath}" />
<arg value="-rf" />
<arg value="${srcdir-ospath}" />
<arg value="-rj" />
<arg value="${external-libs-ospath}" />
</exec>
<echo>It will need to be signed with jarsigner before being published.</echo>
</target>
<!-- Install the package on the default emulator -->
<target name="install" depends="debug">
<echo>Installing ${out-debug-package} onto default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg value="${out-debug-package}" />
</exec>
</target>
<target name="reinstall" depends="debug">
<echo>Installing ${out-debug-package} onto default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg value="-r" />
<arg value="${out-debug-package}" />
</exec>
</target>
<!-- Uinstall the package from the default emulator -->
<target name="uninstall">
<echo>Uninstalling ${application.package} from the default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="uninstall" />
<arg value="${application.package}" />
</exec>
</target>
<!--初始化目录-->
<target name="init" depends="Copy_Ressource">
<echo message="Init output directory.....">
</echo>
<mkdir dir="${output.dir}" />
</target>
<!--拷贝资源-->
<target name="Copy_Ressource">
<echo message="Copy app resource. ">
</echo>
<copy todir="${asset-dir}" overwrite="true" failonerror="false">
<fileset dir="${app.source.path}">
<include name="*.*" />
</fileset>
</copy>
</target>
<!--进行签名-->
<target name="jarsigner" depends="release">
<exec executable="${jarsigner}" failonerror="true">
<arg value="-verbose" />
<arg value="-storepass" />
<arg value="${password}" />
<arg value="-keystore" />
<arg value="android.keystore" />
<arg value="-signedjar" />
<arg value="${out-signed-package-ospath}" />
<arg value="${out-unsigned-package-ospath}" />
<arg value="android.keystore" />
</exec>
</target>
<!--进行优化-->
<target name="zipalign" depends="jarsigner">
<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>
<!--直接上传到手机中去-->
<target name="adb" depends="zipalign">
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg value="-r" />
<arg value="${zipalign-package-ospath}" />
</exec>
</target>
</project>
如果keystore不在此目录,
你就修改 :
<target name="jarsigner" depends="release">
<exec executable="${jarsigner}" failonerror="true">
<arg value="-verbose" />
<arg value="-storepass" />
<arg value="${password}" />
<arg value="-keystore" />
<arg value="android.keystore" />
<arg value="-signedjar" />
<arg value="${out-signed-package-ospath}" />
<arg value="${out-unsigned-package-ospath}" />
<arg value="android" />
</exec>
</target>
中的
<arg value="android.keystore" />
<arg value="android" />
路径,
这个两个参数值要一样即可
build.properties
Java代码
android.tools=${sdk.folder}tools
android_version=2.1
apk.sdk.home=D/:/androidsdktools/android-sdk_r04-windows/android-sdk-windows/
apk.tools=${apk.sdk.home}tools/
application.package=com.test.testname
bin.dir=${jde.home}bin
app.name=NewAndroid
app.source.path=G/:/test/
jdk.home=C/:/Java_1.6_U18/jdk1.6.0_18/
output.dir=../outputDir
password=123456
sdk.folder=D/:/androidsdktools/android-sdk_r04-windows/android-sdk-windows/platforms/android-2.0.1/
temp.dir=127980239039628
[java] view plaincopy
android.tools=${sdk.folder}tools
android_version=2.1
apk.sdk.home=D/:/androidsdktools/android-sdk_r04-windows/android-sdk-windows/
apk.tools=${apk.sdk.home}tools/
application.package=com.test.testname
bin.dir=${jde.home}bin
app.name=NewAndroid
app.source.path=G/:/test/
jdk.home=C/:/Java_1.6_U18/jdk1.6.0_18/
output.dir=../outputDir
password=123456
sdk.folder=D/:/androidsdktools/android-sdk_r04-windows/android-sdk-windows/platforms/android-2.0.1/
temp.dir=127980239039628
Build.xml
Xml代码
<?xml version="1.0" encoding="UTF-8"?>
<project name="Test" default="debug" basedir=".">
<property file="build.properties">
</property>
<!-- The intermediates directory -->
<!-- Eclipse uses "bin" for its own output, so we do the same. -->
<property name="outdir" value="bin" />
<!-- ************************************************************************************* -->
<!-- No user servicable parts below. -->
<property name="android-framework" value="${sdk.folder}/framework.aidl" />
<!-- Input directories -->
<property name="resource-dir" value="res" />
<property name="asset-dir" value="assets" />
<property name="srcdir" value="src" />
<condition property="srcdir-ospath" value="${basedir}/${srcdir}" else="${basedir}/${srcdir}">
<os family="windows" />
</condition>
<property name="external-libs" value="libs" />
<condition property="external-libs-ospath" value="${basedir}/${external-libs}" else="${basedir}/${external-libs}">
<os family="windows" />
</condition>
<!-- Output directories -->
<property name="outdir-classes" value="${outdir}/classes" />
<condition property="outdir-classes-ospath" value="${basedir}/${outdir-classes}" else="${basedir}/${outdir-classes}">
<os family="windows" />
</condition>
<condition property="zipalign-package-ospath" value="${basedir}/${output.dir}/${app.name}_for_android_${android_version}_${temp.dir}.apk" else="${basedir}/${output.dir}">
<os family="windows" />
</condition>
<!-- Create R.java in the source directory -->
<property name="outdir-r" value="src" />
<!-- Intermediate files -->
<property name="dex-file" value="classes.dex" />
<property name="intermediate-dex" value="${outdir}/${dex-file}" />
<condition property="intermediate-dex-ospath" value="${basedir}/${intermediate-dex}" else="${basedir}/${intermediate-dex}">
<os family="windows" />
</condition>
<!-- The final package file to generate -->
<property name="resources-package" value="${outdir}/${ant.project.name}.ap_" />
<condition property="resources-package-ospath" value="${basedir}/${resources-package}" else="${basedir}/${resources-package}">
<os family="windows" />
</condition>
<property name="out-debug-package" value="${outdir}/${ant.project.name}-debug.apk" />
<condition property="out-debug-package-ospath" value="${basedir}/${out-debug-package}" else="${basedir}/${out-debug-package}">
<os family="windows" />
</condition>
<property name="out-unsigned-package" value="${outdir}/${ant.project.name}-unsigned.apk" />
<property name="out-signed-package" value="${outdir}/${ant.project.name}-signed.apk" />
<condition property="out-unsigned-package-ospath" value="${basedir}/${out-unsigned-package}" else="${basedir}/${out-unsigned-package}">
<os family="windows" />
</condition>
<condition property="out-signed-package-ospath" value="${basedir}/${out-signed-package}" else="${basedir}/${out-signed-package}">
<os family="windows" />
</condition>
<!-- Tools -->
<condition property="aapt" value="${android.tools}/aapt.exe" else="${android.tools}/aapt">
<os family="windows" />
</condition>
<condition property="zipalign" value="${apk.tools}/zipalign.exe" else="${apk.tools}/zipalign">
<os family="windows" />
</condition>
<condition property="jarsigner" value="${jdk.home}/bin/jarsigner.exe" else="${jdk.home}/bin/jarsigner">
<os family="windows" />
</condition>
<condition property="aidl" value="${android.tools}/aidl.exe" else="${android.tools}/aidl">
<os family="windows" />
</condition>
<condition property="adb" value="${apk.tools}/adb.exe" else="${apk.tools}/adb">
<os family="windows" />
</condition>
<condition property="dx" value="${android.tools}/dx.bat" else="${android.tools}/dx">
<os family="windows" />
</condition>
<condition property="apk-builder" value="${apk.tools}/apkbuilder.bat" else="${apk.tools}/apkbuilder">
<os family="windows" />
</condition>
<property name="android-jar" value="${sdk.folder}/android.jar" />
<!-- Rules -->
<!-- Create the output directories if they don't exist yet. -->
<target name="dirs" depends="init">
<echo>Creating output directories if needed...</echo>
<mkdir dir="${outdir}" />
<mkdir dir="${outdir-classes}" />
</target>
<!-- Generate the R.java file for this project's resources. -->
<target name="resource-src" depends="dirs">
<echo>Generating R.java / Manifest.java from the resources...</echo>
<exec executable="${aapt}" failonerror="true">
<arg value="package" />
<arg value="-m" />
<arg value="-J" />
<arg value="${outdir-r}" />
<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="dirs">
<echo>Compiling aidl files into Java classes...</echo>
<apply executable="${aidl}" failonerror="true">
<arg value="-p${android-framework}" />
<arg value="-I${srcdir}" />
<fileset dir="${srcdir}">
<include name="**/*.aidl" />
</fileset>
</apply>
</target>
<!-- Compile this project's .java files into .class files. -->
<target name="compile" depends="dirs, resource-src, aidl">
<javac encoding="ascii" target="1.5" debug="true" extdirs="" srcdir="." destdir="${outdir-classes}" bootclasspath="${android-jar}">
<classpath>
<fileset dir="${external-libs}" includes="*.jar" />
</classpath>
</javac>
</target>
<!-- Convert this project's .class files into .dex files. -->
<target name="dex" depends="compile">
<echo>Converting compiled files and external libraries into ${outdir}/${dex-file}...</echo>
<apply executable="${dx}" failonerror="true" parallel="true">
<arg value="--dex" />
<script src="/javascripts/tinymce/themes/advanced/langs/zh.js" type="text/javascript"><!--mce:0--></script><script src="/javascripts/tinymce/plugins/javaeye/langs/zh.js" type="text/javascript"><!--mce:1--></script> <arg value="--output=${intermediate-dex-ospath}" />
<arg path="${outdir-classes-ospath}" />
<fileset dir="${external-libs}" includes="*.jar" />
</apply>
</target>
<!-- Put the project's resources into the output package file. -->
<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>
<!-- Same as package-res-and-assets, but without "-A ${asset-dir}" -->
<target name="package-res-no-assets">
<echo>Packaging resources...</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}" />
<!-- No assets directory -->
<arg value="-I" />
<arg value="${android-jar}" />
<arg value="-F" />
<arg value="${resources-package}" />
</exec>
</target>
<!-- Invoke the proper target depending on whether or not
an assets directory is present. -->
<!-- TODO: find a nicer way to include the "-A ${asset-dir}" argument
only when the assets dir exists. -->
<target name="package-res">
<available file="${asset-dir}" type="dir" property="res-target" value="and-assets" />
<property name="res-target" value="no-assets" />
<antcall target="package-res-${res-target}" />
</target>
<!-- Package the application and sign it with a debug key.
This is the default target when building. It is used for debug. -->
<target name="debug" depends="dex, package-res">
<echo>Packaging ${out-debug-package}, and signing it with a debug key...</echo>
<exec executable="${apk-builder}" failonerror="true">
<arg value="${out-debug-package-ospath}" />
<arg value="-z" />
<arg value="${resources-package-ospath}" />
<arg value="-f" />
<arg value="${intermediate-dex-ospath}" />
<arg value="-rf" />
<arg value="${srcdir-ospath}" />
<arg value="-rj" />
<arg value="${external-libs-ospath}" />
</exec>
</target>
<!-- Package the application without signing it.
This allows for the application to be signed later with an official publishing key. -->
<target name="release" depends="dex, package-res">
<echo>Packaging ${out-unsigned-package} for release...</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-ospath}" />
<arg value="-rf" />
<arg value="${srcdir-ospath}" />
<arg value="-rj" />
<arg value="${external-libs-ospath}" />
</exec>
<echo>It will need to be signed with jarsigner before being published.</echo>
</target>
<!-- Install the package on the default emulator -->
<target name="install" depends="debug">
<echo>Installing ${out-debug-package} onto default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg value="${out-debug-package}" />
</exec>
</target>
<target name="reinstall" depends="debug">
<echo>Installing ${out-debug-package} onto default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg value="-r" />
<arg value="${out-debug-package}" />
</exec>
</target>
<!-- Uinstall the package from the default emulator -->
<target name="uninstall">
<echo>Uninstalling ${application.package} from the default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="uninstall" />
<arg value="${application.package}" />
</exec>
</target>
<!--初始化目录-->
<target name="init" depends="Copy_Ressource">
<echo message="Init output directory.....">
</echo>
<mkdir dir="${output.dir}" />
</target>
<!--拷贝资源-->
<target name="Copy_Ressource">
<echo message="Copy app resource. ">
</echo>
<copy todir="${asset-dir}" overwrite="true" failonerror="false">
<fileset dir="${app.source.path}">
<include name="*.*" />
</fileset>
</copy>
</target>
<!--进行签名-->
<target name="jarsigner" depends="release">
<exec executable="${jarsigner}" failonerror="true">
<arg value="-verbose" />
<arg value="-storepass" />
<arg value="${password}" />
<arg value="-keystore" />
<arg value="android.keystore" />
<arg value="-signedjar" />
<arg value="${out-signed-package-ospath}" />
<arg value="${out-unsigned-package-ospath}" />
<arg value="android.keystore" />
</exec>
</target>
<!--进行优化-->
<target name="zipalign" depends="jarsigner">
<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>
<!--直接上传到手机中去-->
<target name="adb" depends="zipalign">
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg value="-r" />
<arg value="${zipalign-package-ospath}" />
</exec>
</target>
</project>
如果keystore不在此目录,
你就修改 :
<target name="jarsigner" depends="release">
<exec executable="${jarsigner}" failonerror="true">
<arg value="-verbose" />
<arg value="-storepass" />
<arg value="${password}" />
<arg value="-keystore" />
<arg value="android.keystore" />
<arg value="-signedjar" />
<arg value="${out-signed-package-ospath}" />
<arg value="${out-unsigned-package-ospath}" />
<arg value="android" />
</exec>
</target>
中的
<arg value="android.keystore" />
<arg value="android" />
路径,
这个两个参数值要一样即可
发表评论
-
Android使用binder访问service的方式
2013-08-23 09:42 16311. 我们先来看一个与本地service通信的例子。 pub ... -
android-Service和Thread的区别
2013-08-23 09:17 914servie是系统的组件,它由系统进程托管(servicema ... -
git介绍
2013-08-01 14:49 1035git介绍 使用Git的第一件事就是设置你的名字和email ... -
cocos2d-x学习之自动内存管理和常见宏
2013-07-29 15:41 9081.自动内存管理 1)概述 C++语言默认是 ... -
cocos2dx中利用xcode 调用java中的函数
2013-07-29 11:36 25251. 先把cocos2dx根目录中的 /Users/zhaos ... -
cocos2dx(v2.x)与(v1.x)的一些常用函数区别讲解
2013-07-29 10:35 1109第一个改动: CCLayer初始化 自定义Layer,类名 ... -
xcode与eclipse整合cocos2dx
2013-07-29 10:32 1220文档xcode版本是 204 1. 在xcode中创建coc ... -
git提交代码
2013-07-23 16:00 10531. 在本地创建一个Git的工作空间,在里面创建一个工程(如H ... -
Android.mk的用法和基础
2013-07-19 14:11 4332一个Android.mk file用来向编译系统描述你的源代码 ... -
eclipse配置NDK-Builder命令
2013-07-18 11:02 10351. 2. -
eclipse配置javah命令
2013-07-18 10:48 19931.找到javah命令所在的目录 我的为 /usr/bi ... -
Android SDL2.0 编译
2013-07-17 13:40 19671,下载: wget http://www.libsdl.o ... -
IntelliJ Idea 常用快捷键列表
2013-05-27 10:19 0Alt+回车 导入包,自动修 ... -
android应用后台安装
2013-05-21 12:02 1015android应用后台安装,静默安装的代码实现方法 http ... -
编译linux内核映像
2013-05-21 11:33 962a)准备交叉编译工具链 android代码树中有一个pr ... -
如何单独编译Android源代码中的模块
2013-05-21 11:29 994一. 首先在Android源代码 ... -
Ubuntu安装JDK6和JDK5
2013-05-19 19:04 1006sudo apt-get install sun-java6- ... -
java_jni详解_01
2013-05-08 17:15 956java中的jni 例子HelloWorld 准备过程: 1 ... -
下载android源码 中断解决原因
2013-05-07 15:51 1315解决方法 1. 浏览器登录https://android.go ... -
mac下编译ffmpeg1.1.4
2013-05-07 14:55 1364经过一番网上搜索 与 无数次的编译 终于成功了 下面献上编译 ...
相关推荐
### ANDROID_ANT自动编译打包签名教程 #### 一、前言 随着移动应用开发的不断深入和技术迭代,为了提高开发效率与版本发布的便捷性,自动化构建工具的应用变得尤为重要。ANT作为一款开源的Java编译工具,在Android...
在Android应用开发中,构建和打包过程是必不可少的环节,特别是在多渠道发布时,需要针对不同的市场或平台生成定制的APK。...通过理解和配置Ant脚本,你可以有效地管理和自动化整个打包过程,提高开发效率。
本文将详细讲解如何使用Gradle进行Android应用打包,并重点介绍如何实现外部导入签名文件、多渠道打包以及导入Ant脚本这三大核心知识点。 1. 外部导入签名文件: 在发布Android应用时,为了确保应用的安全性和完整...
### Android自动打包方法详解(Ant + ProGuard + 签名) #### 一、引言 随着Android应用的不断普及和发展,如何高效地管理和构建应用程序成为开发者关注的重点之一。为了提高构建效率并确保应用程序的安全性,本文...
总结,使用Ant打包Android应用涉及到了Java和Android开发的基础知识,包括环境配置、构建脚本、编译过程、资源处理、APK打包和签名。虽然现代的Android项目多采用Gradle,但了解Ant可以帮助开发者更好地理解和控制...
- 这个压缩包中的"Command4Ant"可能是一个特定的Ant脚本或者工具集,用于简化或扩展Ant命令,以适应更复杂的Android构建需求。 - 可能包含自定义的任务或宏定义,以处理特定的构建步骤,比如处理依赖库、生成...
在Android应用开发中,发布应用到不同的市场时,通常需要为每个市场创建具有特定标识(如渠道ID)...通过灵活的Ant脚本,你可以轻松地适应不同的市场和统计需求,为你的Android应用带来更广泛的覆盖和深入的数据分析。
进一步优化ANT脚本,可以实现更多的自定义功能,如上传到服务器、发送邮件通知等。此外,你还可以结合其他的构建工具,如Gradle,实现更复杂的构建流程。 总结来说,通过ANT进行Android应用的批量打包,可以极大地...
在Android开发过程中,自动化构建APK文件是提高效率的关键步骤之一。Ant是一个广泛使用的Java构建工具,它允许开发者通过XML配置文件定义...通过自定义Ant脚本,可以实现高度定制化的构建流程,满足不同项目的需要。
"Android多渠道全自动打包发布工具"正是为了解决这个问题,它利用Apache Ant作为构建工具,能够自动化地完成多渠道打包和发布的任务。 Ant是Java的一个开源构建工具,类似于Unix的make,但它是跨平台的。它使用XML...
在Android开发过程中,"安卓自动打包ant"是一个关键步骤,它涉及到如何利用Apache Ant工具自动化构建和打包Android应用(APK)。Apache Ant是一种基于Java的构建工具,它允许开发者通过XML配置文件定义任务来编译、...
本文将详细介绍如何在Eclipse环境下配置Ant脚本,以便自动打包并签名Android应用程序的APK文件。 首先,我们需要安装Ant,它是一个Java编写的开源构建工具。可以从Apache官方网站下载相应版本的Ant安装包,然后将其...
3. 执行打包命令:运行Ant脚本,每次更换渠道配置文件即可生成对应渠道的APK。 **多项目引用** 在大型项目中,通常会将功能模块拆分成多个子项目,以便于管理和维护。Ant支持引用外部项目,使主项目能够编译并依赖...
总的来说,`Ant`多渠道自动打包能显著提高开发效率,但需要对Ant脚本和Android SDK有一定的了解。解决"appt没找到"问题通常涉及到检查和配置SDK环境,确保所有必要的工具都可访问。在实践中,开发者应不断调整和优化...
总之,Ant批量打包Android应用是通过编写自定义的build.xml脚本,结合SDK工具和Ant命令,实现自动化编译和打包的过程。这可以极大地提高开发效率,特别是在需要对多版本或多渠道的应用进行打包时。
在这个场景下,我们可以利用Apache Ant,一个开源的自动化构建工具,来实现自动化的多渠道打包流程。下面将详细介绍如何在Android项目中使用Ant来实现友盟多渠道打包。 首先,确保你的系统已经安装了Java ...
本篇文章将深入探讨如何使用Ant自动打包编译Android应用,并重点介绍`custom_rules.xml`和`ant.properties`这两个配置文件的作用。 `Ant.properties`是Ant构建过程中的一个关键配置文件,它用于存储项目特定的属性...
"安卓自动打包ant auto build Android Package" 主要指的是使用Apache Ant工具进行自动化构建Android应用的过程。Apache Ant是一种Java语言编写的构建工具,它提供了一种基于XML的方式来描述构建过程,使得开发者...