Skip to content
Browse files

Script to sign .apk files

  • Loading branch information...
1 parent 7a20583 commit 921dd39bdfa1fecd57d5331010e9877de58f55d6 @pelya committed Dec 28, 2012
Showing with 35 additions and 1 deletion.
  1. +1 −1 project/jni/application/openarena/engine
  2. +34 −0 sign.sh
2 project/jni/application/openarena/engine
@@ -1 +1 @@
-Subproject commit 8e5c2bbce310547036f47661ce164fcec99de043
+Subproject commit 161a2a2de9206a31d076f077c20bbe197759d3bd
View
34 sign.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Set path to your Android keystore and your keystore alias here, or put them in your environment
+[ -z "$ANDROID_KEYSTORE_FILE" ] && ANDROID_KEYSTORE_FILE=~/.android/debug.keystore
+[ -z "$ANDROID_KEYSTORE_ALIAS" ] && ANDROID_KEYSTORE_ALIAS=androiddebugkey
+
+APPNAME=`grep AppName AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' | tr " '/" '---'`
+APPVER=`grep AppVersionName AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' | tr " '/" '---'`
+
+cd project/bin
+
+# Remove old certificate
+rm -f Signed.apk
+cp -f MainActivity-debug.apk Signed.apk
+zip -d Signed.apk "META-INF/*"
+# Sign with the new certificate
+echo Using keystore $ANDROID_KEYSTORE_FILE and alias $ANDROID_KEYSTORE_ALIAS
+stty -echo
+jarsigner -verbose -keystore $ANDROID_KEYSTORE_FILE -sigalg MD5withRSA -digestalg SHA1 Signed.apk $ANDROID_KEYSTORE_ALIAS
+stty echo
+echo
+zipalign 4 Signed.apk SignedAligned.apk
+rm -f Signed.apk
+
+#DEBUGINFODIR=`aapt dump badging App.apk | grep "package:" | sed "s/.*name=[']\([^']*\)['].*versionCode=[']\([^']*\)['].*/\1-\2/" | tr " '/" '---'`
+DEBUGINFODIR=$APPNAME-$APPVER
+echo Copying debug info to project/debuginfo/$DEBUGINFODIR
+mkdir -p ../debuginfo/$DEBUGINFODIR/armeabi ../debuginfo/$DEBUGINFODIR/armeabi-v7a
+cp -f ../obj/local/armeabi/*.so ../debuginfo/$DEBUGINFODIR/armeabi
+cp -f ../obj/local/armeabi-v7a/*.so ../debuginfo/$DEBUGINFODIR/armeabi-v7a
+cp -f SignedAligned.apk ../debuginfo/$DEBUGINFODIR/$APPNAME-$APPVER.apk
+mv -f SignedAligned.apk ../../$APPNAME-$APPVER.apk
+
+#PKGNAME=`aapt dump badging App.apk | grep "package:" | sed "s/.*name=[']\([^']*\)['].*versionCode=[']\([^']*\)['].*/\1/"`
+#adb install -r App.apk || { adb uninstall $PKGNAME ; adb install -r App.apk ; }

0 comments on commit 921dd39

Please sign in to comment.
Something went wrong with that request. Please try again.