First, build ant pack apk
- Create a new
TestAnt project
-
Create the app's signing key
Refer to my this GitHub, welcome star| click here
-
After the key is taken, create a KeyStore folder in the project and copy the key to this
-
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
#使用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