Last active
March 9, 2025 09:01
-
-
Save vavrecan/8596303 to your computer and use it in GitHub Desktop.
Revisions
-
vavrecan revised this gist
Jan 24, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ #!/bin/bash # author Marek Vavrecan (vavrecan@gmail.com) # show usage [ $# -eq 0 ] && { echo "Usage: $0 [apk path] [source namespace] [target namespace]"; exit 1; } -
vavrecan created this gist
Jan 24, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ #!/bin/bash # show usage [ $# -eq 0 ] && { echo "Usage: $0 [apk path] [source namespace] [target namespace]"; exit 1; } APK_PATH="$1" NAMESPACE_FROM="$2" NAMESPACE_TO="$3" # escape . NAMESPACE_REPLACE=$(echo "s/$NAMESPACE_FROM/$NAMESPACE_TO/g" | sed -e 's/\./\\\./g') # change to smalli support com.namespace to com/namespace NAMESPACE_SLASHES_REPLACE=$(echo "s/$NAMESPACE_FROM/$NAMESPACE_TO/g" | sed -e 's/\./\\\//g') if [ -f "apktool.jar" ]; then else echo "Please get apktool from http://code.google.com/p/android-apktool/ to continue" exit 1; fi java -jar apktool.jar d -o out -f $APK_PATH # replace tricks find ./out -type f -exec sed -i $NAMESPACE_REPLACE {} \; find ./out -type f -exec sed -i $NAMESPACE_SLASHES_REPLACE {} \; find ./out -type f -exec sed -i 's/<string name="app_name">\(.*\)<\/string>/<string name="app_name">\1 Beta<\/string>/g' {} \; mv out/smali/com/youcognize out/smali/com/youcognizebeta # compile java -jar apktool.jar b -o ./debug.apk -f ./out # sign it again jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore key.keystore ./debug.apk "password" -storepass "password" -keypass "password" # cleanup rm -R ./out # to get key # keytool -genkey -v -keystore key.keystore -alias password -keyalg RSA -keysize 2048 -validity 10000 # this might be needed to fix align, but was not needed so far # zipalign -v 4 debug.apk debug2.apk