Skip to content

Instantly share code, notes, and snippets.

@hugozap
Last active December 11, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugozap/4614108 to your computer and use it in GitHub Desktop.
Save hugozap/4614108 to your computer and use it in GitHub Desktop.
Build and sign .apk and send it to ftp
#!/bin/bash
# Change to your android project path
SRCPATH="$HOME/Developer/src/android_project_path"
# Ftp settings
SERVER="ftp.example.com"
USER=YOUR_FTP_USER
PASS=YOUR_FTP_PASSWORD
REMOTEDIR="/"
# Change it to the .apk generated in the bin directory
Filename=MyProject-release.apk
# Build.xml path
BUILDFILE="$SRCPATH/build.xml"
# Path of the generated .apk file
APKFILE="$SRCPATH/bin/$Filename"
# Name of the file that will be uploaded ( i needed it to be different )
TARGETFILE="$SRCPATH/bin/myproject_buil.apk"
# -------- Clean existing files --------
echo "**Removing apks**"
rm -f $APKFILE
rm -f $TARGETFILE
echo "ant release"
ant -buildfile $BUILDFILE release
# ------- Rename file --------
mv $APKFILE $TARGETFILE
# ------- Upload to ftp -----------
echo "Uploading file to $SERVER"
ncftpput -m -u $USER -p $PASS $SERVER $REMOTEDIR $TARGETFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment