This commit is contained in:
Cat /dev/Nulo 2021-10-18 15:30:49 -03:00
commit a05dc22a5f
3 changed files with 23 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
my-release-key.keystore

BIN
output.apk Normal file

Binary file not shown.

22
patch.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
dir="$(mktemp -d)"
echo "=> $dir"
if test ! -f my-release-key.keystore; then
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
fi
# force-all because $dir already exists
apktool decode "$1" --force-all --output "$dir" || exit 1
# https://stackoverflow.com/questions/50461881/java-lang-noclassdeffounderrorfailed-resolution-of-lorg-apache-http-protocolve#50779232
sed -i "s/<\/application>/<uses-library android:name=\"org.apache.http.legacy\" android:required=\"false\" \/><\/application>/" "$dir/AndroidManifest.xml" || exit 1
apktool build "$dir" || exit 1
mv "$dir"/dist/* "$dir/dist/output.apk"
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore "$dir/dist/output.apk" alias_name || exit 1
cp "$dir/dist/output.apk" . || exit 1
rm -rf "$dir"