Although eclipse is seldom used, it is still used in old projects. A troublesome thing is to play with a signature package when it is very inconvenient. Configure Ant on the bottom record and automatically pack the process with the signature apk as a memo. (PC Environment for Mac)
1, the first step ant, download the corresponding installation package, unzip the configuration environment variables:
Export Ant_home= "/users/yanzi/work/apache-ant-1.9.4"
Export Path=${path}:${ant_home}/bin
Check whether the installation was successful by which Ant.
2, run under Project directory:android update project-p./If there is a dependency package, run the next command under each dependent package directory. After running this command, there will be two more files: Build.xml and Local.properties
Local.properties File Contents:
sdk.dir=/users/yanzi/work/android-tool/android-SDK-MacOSX
Build.xml File Contents:
<?xml version= "1.0" encoding= "UTF-8"? ><project name= "Tongcheng" default= "Help" > <!--the Local.properties file is created and updated by the ' Android ' tool. It contains the path to the SDK. It should *not* is checked into Version Control Systems. --<property file= "local.properties"/> <!--the ant.properties file can created by you. It is only edited by the ' Android ' tool to add properties to it. The "the" to "change some Ant specific build properties. Here is some properties want to change/update:source.dir the name of the source directory. Default is ' src '. Out.dir the name of the output directory. Default is ' bin '. For other overridable properties, look at the beginning of the rules files in the SDK, at Tools/ant/build.xml Properties related to the SDK location or the project target should is updated using the ' AndroidOID ' tool with the ' Update ' action. This file is a integral part of the build system for your application and should are checked into Version Control Systems. --<property file= "ant.properties"/> <!--if Sdk.dir is not set from one of the property file and then Get it from the Android_home env var. This must is done before we load project.properties since the Proguard config can use Sdk.dir--<proper Ty environment= "env"/> <condition property= "Sdk.dir" value= "${env". Android_home} "> <isset property=" env. Android_home "/> </condition> <!--The project.properties file is created and updated by the ' Android ' Tool, as well as ADT. This contains project specific properties such as project target, and library dependencies. Lower level build properties is stored in ant.properties (or in. classpath for Eclipse projects). This file was an inteGral part of the build system for your application and should is checked into Version Control Systems. --<loadproperties srcfile= "Project.Properties"/> <!--quick check on Sdk.dir-<fail Message= "Sdk.dir is missing. Make sure to generate Local.properties using ' Android Update Project ' or to inject it through the android_home environment Variable. " unless= "Sdk.dir"/> <!--Import per project custom build rules if present at the root of the project. This was the place to put custom intermediary targets such as:-pre-build-pre-compile -post-compile (this was typically used for code obfuscation. Compiled code location: ${out.classes.absolute.dir} If The is not do in place, override ${out . Dex.input.absolute.dir})-post-package-post-build-pre-clean--<import fi le= "Custom_rules.xml "optional=" true "/> <!--Import the actual build file. To customize existing targets, there is, options:-Customize only one target:-Copy/paste the TA Rget into this file, *before* the <import> task. -Customize it to your needs. -Customize the whole content of build.xml-copy/paste the content of the rules files (minus the top node) Into this file, replacing the <import> task. -Customize to your needs. IMPORTANT ****** *********************** In all cases must UPDA Te the value of Version-tag below to read ' custom ' instead of a integer, in order to avoid have your file be ov Erridden by tools such as "Android Update Project"-<!--version-tag:1--<import file= "${sdk.di R}/tools/ant/build.xml "/></project>
None of the two files are moving, and the name of the top project is written with the names you want. Then create a new ant.properties under the project root directory, with the following content:
# This file was used to override default values used by the Ant build system.## This file must being checked in Version contro L Systems, as it is# integral to the build system of your project.# this file is only used by the Ant script.# you can use This to override default values such as# ' Source.dir ' for the location of the your Java source folder and# ' Out.dir ' For the location of your output folder.# your can also use it define how the release builds is signed by declaring# the FO llowing properties:# ' Key.store ' for the location of your keystore and# ' Key.alias ' for the name of the key to use . # The password'll be asked during the ' release ' Target.key.alias=com.tongchengkey.store=tongchen g.keystorekey.store.password=12377778key.alias.password=12377778
Configures information about the KeyStore.
Doing ant clean first and then executing ant release is ok!
3, of course, in order to be more cool, you need the following script:
Vim release.sh, the content is as follows:
echo-----------------start---------
start=$ (Date +%s)
Ant Clean
Ant Release
ADB uninstall Com.android.tongcheng
ADB install bin/tongcheng-release.apk
end=$ (Date +%s)
echo "----over, Time $[${end}-${start}] seconds---"
After each time you want to install a signed package, directly./release.sh!
For multi-channel packages, please refer to this article
Configure ant script to automatically pack signed Android APK under Eclipse