Auto-sign with ant, pack Android apk and automatically install to your phone

Source: Internet
Author: User

First, build ant pack apk
    1. Create a new TestAnt project
    2. Create the app's signing key

      Refer to my this GitHub, welcome star| click here

    3. After the key is taken, create a KeyStore folder in the project and copy the key to this

    4. Adding Ant to a project

//到项目的上级目录cd /Users/.../Documents/workspace///给相聚添加ant,-p 项目 -t 是target 我这里是android-21android update project -p TestAnt -t android-21 --subprojects//这条命令执行完毕会创建build.xml 和proguard-project.txt 文件,会更新local.properties

5. Create a new ant.properties and add a key

//密钥的路径key.store=<keystore>//别名key.alias=<key>//store 的密码key.store.password=<keystore pwd>//alias 的密码key.alias.password=<key pwd>


6. Run Ant

SELECT [Build.xml][run as] [antbuild ...]

Tick clean and debug

View the Run log

Second, install to the mobile phone and write scripts to achieve automatic

1. Install to Phone

//复制中```[echo] Debug Package:```的路径adb install 路径
    • If you want to learn more about the difference between adb push adb install adb install-r three commands, click here

2. Write the script and put it in the project directory

    • run.sh
#使用ant编译为debug版本ant clean debug#安装apk到手机adb install -r bin/TestAnt-debug.apk
    • In Mac is run.sh in Win is Run.bat

3. Run the script

cd 项目路径./run.sh

4. Error

    • Run the./run.sh prompt Permission denied without permission
777 run.sh
    • Run completed, but prompt Invalid APK file: bin/TestAnt-debug.apk for invalid apk
修改build.xml文件中的project 的name为项目的名称TestAnt

Auto-sign with ant, Pack Android apk, and automatically install to your phone

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.