Troubleshooting ADB Install Failure: INSTALL_CANCELED_BY_USER on Xiaomi Devices

Troubleshooting ADB Install Failure: INSTALL_CANCELED_BY_USER on Xiaomi Devices

22 April 2024 Stephan Petzl Leave a comment Tech-Help

Understanding the Issue

When attempting to install an application on a Xiaomi device using ADB, users may encounter an error that reads “INSTALL_CANCELED_BY_USER” despite not canceling the installation themselves. This issue can occur across various Xiaomi devices, including the Xiaomi MI5, running MIUI 7.2.13, Android 6.0, with Developer mode enabled.

Common Solutions

The error message indicates that the installation process is being interrupted by a system-level block, typically related to MIUI’s security features. The following steps outline the common solutions to resolve this problem:

  1. Navigate to the “Security” application on your Xiaomi device.
  2. Tap the “Options” at the top right corner of the screen.
  3. Scroll down to the “Feature Settings” group and select “Permissions”.
  4. Locate the “Install via USB” option and toggle it off. This option manages the installation of apps via USB and may be preventing the process.

For the latest Xiaomi devices, you may need to follow these steps instead:

  1. Open “Settings” and go to “Additional Settings”.
  2. Select “Developer Options”.
  3. Ensure the “Install via USB” option is checked.

In some cases, you may also need to disable “MIUI Optimization” within the Developer Options for the installation to proceed successfully.

Additional Tips

If the standard solution does not work, here are some additional tips that may help:

  • Ensure you are signed into your MI account, as this may be required to authorize the installation.
  • Try resetting the Developer Options to default values to reveal and disable the “MIUI Optimization” setting.
  • If you’ve previously denied installation permissions, check under Apps -> Permissions -> Install via USB and ensure it is activated.

How Repeato Can Help

In the context of automating app installations and testing, our product Repeato can streamline the process. As a no-code test automation tool for iOS and Android, Repeato simplifies the creation, execution, and maintenance of automated tests for your apps. It’s particularly efficient for editing and running tests, leveraging computer vision and AI to work with various app frameworks like React Native, Flutter, and Unity.

Repeato comes with ADB on board, allowing the execution of ADB commands via script steps. This can be especially useful when automating the installation of apps on Xiaomi devices, as it provides a programmable way to manage the settings that could be causing the “INSTALL_CANCELED_BY_USER” error.

For more insights on automating and managing ADB commands, check out our articles on managing ADB shell with multiple connected devices and launching Android applications via ADB.

Like this article? there’s more where that came from!