Last active
August 29, 2015 14:16
-
-
Save SOLUNTECH/d5112e1eebe197516790 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo 'Debes tener en cuenta que deben estar previamente instalados el sdk de android, cordova y jdk de JAVA, asà como los PATHS correspondientes a cada uno \n' | |
echo 'Preparando APK ...' | |
sudo rm appSigned.apk | |
sudo cordova build --release android | |
keyname="signerkey" #remplazar por el nombre por defecto de la llave generada | |
appid="com.app.exampleid" #remplazar por el id de la aplicacion que compilaremos | |
echo "Deseas generar una llave para firmar la APK? [y -n]" | |
read cond | |
if [ "$cond" = "y" ] | |
then | |
echo "Ingresa un alias para tu llave: [o Enter para autogenerarlo]" | |
read Alias | |
if [ "$Alias" = "" ] | |
then | |
Alias="gomoalias" | |
fi | |
keytool -genkey -v -keystore "$keyname.keystore" -alias "$Alias" -keyalg RSA -keysize 2048 -validity 10000 | |
else | |
echo "Ingresa el nombre de tu llave: (sin la extension .keystore) [o Enter para usar el nombre por defecto]" | |
read _keyname | |
if [ "$keyname" != "" ] | |
then | |
keyname=_keyname | |
fi | |
echo "Ingresa el Alias de tu llave: " | |
read Alias | |
fi | |
sudo jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore "$keyname.keystore" platforms/android/ant-build/CordovaApp-release-unsigned.apk "$Alias" | |
$ANDROID_HOME/build-tools/"21.1.1/zipalign" -v 4 platforms/android/ant-build/CordovaApp-release-unsigned.apk appSigned.apk | |
$ANDROID_HOME/build-tools/"21.1.1/zipalign" -c -v 4 appSigned.apk | |
echo "Desea instalar la APP en un dispositivo de prueba? [y - n]" | |
read cond | |
if [ "$cond" = "y" ] | |
then | |
echo 'Ingresa el id de tu app ej. com.app.miapp [o Enter para usar id por defecto]' | |
read _appid | |
if [ "_appid" != "" ] | |
then | |
appid = _appid | |
fi | |
echo 'Se intentará desinstalar la APP, revisa la pantalla del dispositivo y acepta la desinstalación' | |
adb shell am start -a android.intent.action.DELETE -d package:"$appid" | |
echo 'Instalando APP en el dispositivo' | |
adb install appSigned.apk | |
echo 'Listo' | |
adb logcat CordovaLog:D *:S | |
else | |
echo 'APP lista para la Play Store - Soluntech' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment