Resolved Amazon Appstore can't install apps, no "Turn off MIUI optim." option => WORKAROUND


MossyTC

Members
Oct 4, 2019
4
3
[ 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

  1. In Root Browser navigate to /data/media/0/scripts/
  2. Select appstore.sh (tap and hold until the file is highlighted)
  3. Open the menu on the top right (the the three vertical dots)
  4. Select Properties
  5. Go to the Permissions tab
  6. Tick the boxes under X ('x' for execute)
  7. 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...
  1. Run the script (see above)
  2. Attempt to install your app with the Appstore.
  3. 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.
  4. Open the *.apk file in /sdcard/apk to install.
After installation you can safely delete the *.apk file.

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:

Igor Eisberg

Developer
Staff member
Oct 6, 2016
6,545
322
I have a proper solution to this. Your device is Redmi Note 7 Pro, correct? Because we never released V10.3.6 for Redmi Note 7.

Assuming your device is indeed Redmi Note 7 Pro, try flashing this, let me know if it solves install issues with Amazon Appstore:
 

MossyTC

Members
Oct 4, 2019
4
3
I have a proper solution to this. Your device is Redmi Note 7 Pro, correct? Because we never released V10.3.6 for Redmi Note 7.

Assuming your device is indeed Redmi Note 7 Pro, try flashing this, let me know if it solves install issues with Amazon Appstore:

Sorry, I meant to type 10.3.4.

So, no not Pro just regular Redmi Note 7.

I'm sorry if I put you out to create a Note 7 Pro specific fix!
 

Igor Eisberg

Developer
Staff member
Oct 6, 2016
6,545
322
Sorry, I meant to type 10.3.4.

So, no not Pro just regular Redmi Note 7.

I'm sorry if I put you out to create a Note 7 Pro specific fix!
Here's a ZIP for Redmi Note 7: