Skip to content

Instantly share code, notes, and snippets.

@faridlab
Created October 2, 2014 07:04
Show Gist options
  • Save faridlab/47963b394759dcd88b4e to your computer and use it in GitHub Desktop.
Save faridlab/47963b394759dcd88b4e to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "***************************************************************";
echo "* Android prepare for playstore *";
echo "*-------------------------------------------------------------*";
echo "* Before further more, please make sure: *";
echo "* - check last version of the Android application *";
echo "* - check API production ( Java, Javascript and Objective C ) *";
echo "* - check packages to include your application *";
echo "* - check debuggable in AndroidManifest.xml to be 'false' *";
echo "***************************************************************";
echo "";
read -r -p "Are you sure, everything is Okay? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
cd ./platforms/android;
echo "Remove *.apk file"
rm *.apk; # make it sure
echo "*.apk removed."
# release android version;
echo "Release android version.";
ant release;
echo "Android release version done !.";
cd ./bin
list=$(ls | grep *-release-unsigned.apk | grep -v '\.d')
apk=${list//-release-unsigned.apk/''}
cd ../
# generate keytool if it is not exist
if [ ! -f playstore.keystore ];
then
echo "keystore is not exist, the system automatically generate new keystore.";
echo "please remember your 'Passphrase' as 'Passphrase for keystore'."
keytool -genkey -v -keystore playstore.keystore -alias playkeystore -keyalg RSA -keysize 2048 -validity 20000;
fi
echo "enter your 'Passphrase' as Passphrase for keystore";
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore playstore.keystore bin/${apk}-release-unsigned.apk playkeystore;
zipalign -v 4 bin/${apk}-release-unsigned.apk ${apk}.apk;
cd ../..;
echo "Happy upload to play store. ;D";
else
echo "Aborted !.";
exit;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment