You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
868 B

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
# force-all because $dir already exists
apktool decode "$1" --force-all --output "$dir" || exit 1
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"