[ An alternative workaround is to use a different device to install the app using your Amazon Appstore account, then use an APK Extractor to get a copy of the install file (*.apk) which you can copy to your Mi device and install with a file browser ]
MIUI 10.3.4 | Stable on Redmi Note 7
Log - https://pastebin.com/cqCrcpaW
Log started with Appstore running already, just before attempt to install was initiated. The app failing to install is a paid app, though the same problem happens with free apps.
Appstore downloads the APK file and deletes the file shortly after when the install fails.
The workaround is to copy the APK file before it is deleted, and open it later with a file browser, e.g. the Files app, to install.
The script at the end of this post can be run just before you attempt to install an in the Appstore. The script waits until an APK file appears in Amazon Appstore's download directory and repeatedly copies the file to a folder in your internal storage until the file is deleted from the download directory by the Appstore. The file is copied repeatedly during the download because the script has no way of knowing when the download has completed, until the download file disappears. The script copies the APK file to /sdcard/apk/, though this path can be changed by editing script.
The script can be run in a terminal, or adb shell, or in Tasker or with a script running app like $cripter. root and busybox (e.g. Magisk module Busybox for Android NDK) are required.
To use the script copy the text (excluding the "Bash:" line) into a text editor, save it as a file, e.g. "appstore.sh" and copy it to the internal storage of your phone, e.g. /sdcard or /sdcard/scripts/. To change the permissions of the script and to execute the script you must use the /data/media/0/ form of the internal storage path instead of /sdcard/. /data/media/0/ points to the same internal store as /sdcard/ but accessing the internal storage this way allows you to change permissions on the files and execute them. Using a root-enabled file browser like Root Browser, navigate to the folder containing the script under /data/media/0/ and set the execute permission for the script, e.g. if you copied the script to /sdcard/scripts/, then
To run the script you must use the /data/media/... version of it's path, e.g. /data/media/0/scripts/appstore.sh.
To run the script in a terminal or adb shell just type the full path of the script (e.g. /data/media/0/scripts/appstore.sh ) at the prompt and hit return. You must do this as root (type su and hit return before entering the command).
To run in Tasker create a Code action of type Run Shell with the full script path as the Command (e.g. /data/media/0/scripts/appstore.sh ).
To use the script to capture the APK install file...
The following is the script (do NOT include the "Bash:" line when copying)
MIUI 10.3.4 | Stable on Redmi Note 7
Log - https://pastebin.com/cqCrcpaW
Log started with Appstore running already, just before attempt to install was initiated. The app failing to install is a paid app, though the same problem happens with free apps.
Appstore downloads the APK file and deletes the file shortly after when the install fails.
The workaround is to copy the APK file before it is deleted, and open it later with a file browser, e.g. the Files app, to install.
The script at the end of this post can be run just before you attempt to install an in the Appstore. The script waits until an APK file appears in Amazon Appstore's download directory and repeatedly copies the file to a folder in your internal storage until the file is deleted from the download directory by the Appstore. The file is copied repeatedly during the download because the script has no way of knowing when the download has completed, until the download file disappears. The script copies the APK file to /sdcard/apk/, though this path can be changed by editing script.
The script can be run in a terminal, or adb shell, or in Tasker or with a script running app like $cripter. root and busybox (e.g. Magisk module Busybox for Android NDK) are required.
To use the script copy the text (excluding the "Bash:" line) into a text editor, save it as a file, e.g. "appstore.sh" and copy it to the internal storage of your phone, e.g. /sdcard or /sdcard/scripts/. To change the permissions of the script and to execute the script you must use the /data/media/0/ form of the internal storage path instead of /sdcard/. /data/media/0/ points to the same internal store as /sdcard/ but accessing the internal storage this way allows you to change permissions on the files and execute them. Using a root-enabled file browser like Root Browser, navigate to the folder containing the script under /data/media/0/ and set the execute permission for the script, e.g. if you copied the script to /sdcard/scripts/, then
- In Root Browser navigate to /data/media/0/scripts/
- Select appstore.sh (tap and hold until the file is highlighted)
- Open the menu on the top right (the the three vertical dots)
- Select Properties
- Go to the Permissions tab
- Tick the boxes under X ('x' for execute)
- Tap Apply
To run the script you must use the /data/media/... version of it's path, e.g. /data/media/0/scripts/appstore.sh.
To run the script in a terminal or adb shell just type the full path of the script (e.g. /data/media/0/scripts/appstore.sh ) at the prompt and hit return. You must do this as root (type su and hit return before entering the command).
To run in Tasker create a Code action of type Run Shell with the full script path as the Command (e.g. /data/media/0/scripts/appstore.sh ).
To use the script to capture the APK install file...
- Run the script (see above)
- Attempt to install your app with the Appstore.
- After the install fails go to /sdcard/apk in a file browser - note that it's normal for the script to end with a "can't stat... No such file..." error.
- Open the *.apk file in /sdcard/apk to install.
The following is the script (do NOT include the "Bash:" line when copying)
Bash:
#!/system/bin/sh
TARGET=/sdcard/apk
SOURCE=/data/user/0/com.amazon.venezia/files/apks
mkdir -p $TARGET
cd $TARGET
while [[ $(ls -1 $SOURCE/ | wc -l) -eq 0 ]]; do a=0; done;
filesize=0
go=true
while [[ $go == true ]]; do
for file in $SOURCE/*.apk
do
if [[ -z "${file##*\**}" ]]
then
go=false
break
fi
new_filzesize=$(stat -c%s "$file")
if [[ $new_filzesize -gt $filesize ]]
then
cp $file .
filesize=$new_filzesize
fi
done
done
Last edited: