CCCPaste

Android Unpack and Repack APK files

#Unpacking and repacking APKs for Android
sudo apt install apksigner zipalign apktool

#####MAKE SURE YOU HAVE THE NEWEST RELEASE!!!!!!!!!!!!!
#or get current release
# https://github.com/iBotPeaches/Apktool/releases/
wget "https://github.com/iBotPeaches/Apktool/releases/download/v2.7.0/apktool_2.7.0.jar"

#list apks on device
adb shell pm list packages -f -3

#pull apk from device
adb pull /data/app/com.stupid.name-yX7iNj2s_26_re5bRH-Hfw==/base.apk

#unpack apk
apktool d base.apk
#or if jar file downloaded from git
java -jar apktool_2.7.0.jar d base.apk 

#make changes and repack
####To make home screen launcher add this to AndroidManifest.zml#####




apktool b base
#or if jar file downloaded from git
java -jar apktool_2.7.0.jar b base

#alg
zipalign -f -p 4 base/dist/base.apk myapp.apk

#create key to sign with - and password for key
keytool -genkey -v -keystore release.keystore -alias example -keyalg RSA -keysize 2048 -validity 10000


#sign the apk - remember the password you just created
apksigner sign --ks release.keystore myapp.apk

#install on device
adb install myapp.apk

##Note, if the app is already installed with a different key you will need to uninstall it first