When publishing an APK is a burden, you must enter the automation mode.
This article uses ant for compilation, signature, alignment, and release.
1 download sun-java6-jdk
Refer to here for download.
Export java_home =/usr/lib/JVM/Java-6-sun
2. Generate ant build. XML for an existing project
Run the command line to the root directory of the current project and run the following command:
android update project --path .
You can use the ant command to view related information and help, as shown below:
$ ant $ ant debug
If you need proguard, turn off the debuggable in androidmanifest. xml. (when you look up the information, you find that the gap between Chinese and foreign countries is too large. The Chinese version of this article is still a long term ).
3 shipment! Shipment! Script:
#!/bin/bashAPP_NAME="StandardLauncher"CD="."RELEASE_APP=$CD/bin/$APP_NAME-release-signed.apkRELEASE_DIR=~/released_apks/standardLauncherPWD="xxx"#ant releaseecho "Sign apk..."cp $CD/bin/$APP_NAME-release-unsigned.apk $RELEASE_APP"$JAVA_BIN/jarsigner" -keystore "my-release-key.keystore" -storepass $PWD -keypass $PWD $RELEASE_APP "my-release-key"echo "Verigy apk...""$JAVA_BIN/jarsigner" -verify $RELEASE_APPversionName=$(aapt d badging $RELEASE_APP |grep versionName= | cut -d "=" -f4 | cut -d "'" -f2)echo "Get versionName = $versionName"echo "zipalign apk..."zipalign -f 4 $RELEASE_APP "$RELEASE_APP"_alignedcp "$RELEASE_APP"_aligned $RELEASE_DIR/"$APP_NAME"_V"$versionName"_build_$(date +%Y%m%d).apkecho "Clean up..."rm -v $RELEASE_APPrm -v "$RELEASE_APP"_alignedcd $RELEASE_DIR$RELEASE_DIR/cleanup.sh
The command to obtain the version name in the middle of PS needs to be improved.