Browse Source

use a repackaging script to remove File Shuttle for Google Play

* It is not supported on Google Play for now.
master
Peter Cai 1 year ago
parent
commit
87e72dfa01
No known key found for this signature in database GPG Key ID: 71F5FB4E4F3FD54F
  1. 4
      .gitignore
  2. 28
      repackage/repackage.sh

4
.gitignore

@ -76,3 +76,7 @@ fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
# temporary google play repackaging tool
repackage/*
!repackage/repackage.sh

28
repackage/repackage.sh

@ -0,0 +1,28 @@
#!/bin/bash
# Google Play does not yet allow MANAGE_EXTERNAL_STORAGE apps
# so we have to work around this for now
echo "==> Repackaging Shelter ($1) for Google Play"
apktool -o work d $1
echo "=> Removing MANAGE_EXTERNAL_STORAGE from manifest"
sed -i '[email protected]<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>@@g' work/AndroidManifest.xml
echo "=> Disabling File Shuttle in preferences"
sed -i '[email protected]:key="settings_cross_profile_file_chooser"@android:key="settings_cross_profile_file_chooser" android:enabled="false"@' work/res/xml/preferences_settings.xml
echo "=> Building new APK"
sed -i -e "s/versionName: '\(.*\)'/versionName: '\\1-google'/" work/apktool.yml
pushd work
apktool b
popd
mv work/dist/*.apk app-release-google.apk
rm -rf work
echo "=> Zipaligning the new APK"
$ANDROID_HOME/build-tools/30.0.2/zipalign -f 4 app-release-google.apk app-release-google-aligned.apk
echo "=> Signing the new APK"
read -p "Enter keystore path: " KS_PATH
read -p "Enter key alias: " KS_ALIAS
$ANDROID_HOME/build-tools/30.0.2/apksigner sign --ks $KS_PATH --ks-key-alias $KS_ALIAS app-release-google-aligned.apk
Loading…
Cancel
Save