Skip to content

Instantly share code, notes, and snippets.

@Nithanim
Last active October 27, 2024 17:55
Show Gist options
  • Save Nithanim/18448acbe400b1fb83ff39c8d43a0452 to your computer and use it in GitHub Desktop.
Save Nithanim/18448acbe400b1fb83ff39c8d43a0452 to your computer and use it in GitHub Desktop.
Install an app without google play that checks if it was installed via google play

There are some apps that check if they were installed via google play. Apps can even refuse to run if they detect that they were not. This can be a problem for you if you install apps via the aurora store ore manually.

To work around this people found a very dumb workaround that you might even dismiss if you read it the first time. Basically, it boils down to summing up the file sizes of the individual apks and give that to the package installer. This also works if you already installed the app and it refuses to run. You can just install/update over he existing one even if it is the same version.

Bsically this: https://www.reddit.com/r/Austria/comments/p8qd8y/wie_man_die_george_app_auch_ohne_google_play_zum/

You need to get the app "Package Manager" (com.smartpack.packagemenager). With it, you can extract an installed app into an apkm.

Then, basically the script attached to this gist takes over.

Somehow put it onto your device and execute it with bash. Exccution is also possible via adb shell.

For some reason, there can be the following messeges all over: job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Math result not representable Not sure how that can be fixed, but it can be ignored, if it runs through and prints the success message.

set -e
if [ -n "${BASH_VERSION}" ]
then
echo "BASH must be used, current shell is $SHELL"
exit 1
fi
# REPLACE THE NAMES HERE IF YOU USE SOME OTHER APP!
source_apkm=(/sdcard/Package_Manager/at.erstebank.george_*.apkm)
echo "Using file $source_apkm"
# THE ANDROID PM IS PICKY ABOUT THE FOLDER FROM WHERE STUFF IS INSTALLED
temp_dir="/data/local/tmp/instworkaround"
echo "Using $temp_dir as temp dir"
mkdir -p "$temp_dir"
rm -f "$temp_dir/*"
unzip -o "$source_apkm" -d "$temp_dir"
# SUM UP THE SIZES OF THE FILES
sum=0
for f in $temp_dir/*.apk; do
name=$(stat -c "%n" "$f")
size=$(stat -c "%s" "$f")
echo "Using file "$name" with size $size"
sum=$(($sum+$size))
done
echo "File size sum is $sum"
# PASS THE SUM TO THE INSTALLER
echo "Creation a special PM session"
line=$(pm install-create -S $sum -i "com.android.vending")
echo "PM output is: $line"
# EXTRACT THE SESSION ID FROM THE MESSAGE
regex="[^\[]*\[([0-9]+)\].*"
if [[ $line =~ $regex ]]
then
sessionid="${BASH_REMATCH[1]}"
echo "Session id is $sessionid"
else
echo "Cannot get session id!"
exit 2
fi
# GIVE THE FILES TO THE INSTALLER
echo "Passing individual apks to PM..."
number=0
for f in $temp_dir/*.apk; do
name=$(stat -c "%n" "$f")
size=$(stat -c "%s" "$f")
echo "Passing file "$name" of size $size"
pm install-write -S $size "$sessionid" $number "$f"
number=$(($number+1))
done
# CONCLUDE THE INSTALLATION
echo "Committing installation with PM"
pm install-commit $sessionid
echo "INSTALLATION COMPLETED, app should now work!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment