22 April 2024 Leave a comment Tech-Help
Understanding the Error
Developers often encounter an error stating “INSTALL_FAILED_USER_RESTRICTED: Install canceled by user,”
especially when working with Redmi devices. This error can occur when attempting to run an APK on a Redmi device,
and may be accompanied by a note that suggests uninstalling the existing version of the app.
The error is typically related to developer settings on the device that restrict the installation of apps
via USB. To resolve this issue, certain settings within the device need to be configured properly.
Step-by-Step Solution for MIUI 9 and Above
- Navigate to Settings > Additional Settings > Developer options.
- Disable “MIUI optimization” and restart your device.
- Ensure “USB Debugging” is turned on.
- Enable “Install via USB”. The MTP (Media Transfer Protocol) is the default mode and should generally work, but if it doesn’t, try setting the USB Configuration to “Charging”.
These steps should rectify the issue for most users. However, if the problem persists, try the additional measures listed below.
Additional Measures
- Ensure you have “Install via USB” and “USB Debugging (Security settings)” enabled in Developer options.
- If you receive an error stating “The device is temporarily restricted”, try turning off Wi-Fi and using mobile data before enabling “Install via USB”.
- If you have previously denied installation permissions, you can modify them by going to Settings > Permissions > Install via USB and adjusting the permissions for your app.
- For MIUI 12, you may also need to allow “Android System” to install from unknown apps. This can be found under Settings > Apps > Special Access > Install Unknown Apps.
- In some cases, especially after logging out and back into your Mi account, you may need to add your account and device in Developer Options > Mi Unlock Status.
Integrating with Repeato
While troubleshooting installation issues is important, ensuring the quality and robustness of your app through testing is equally crucial. Repeato, a no-code test automation tool for iOS and Android, can help streamline your testing process. With its ability to create, run, and maintain automated tests quickly using computer vision and AI, Repeato is compatible with various app frameworks such as React Native, Flutter, and Unity.
Repeato comes with ADB onboard, allowing you to execute ADB commands via script steps, which can be particularly useful when dealing with installation issues or configuring devices for testing. For additional guidance on using ADB with Android devices, explore our articles on Launching Android Applications via ADB and Managing ADB Shell with Multiple Connected Devices.
By incorporating Repeato into your workflow, you can ensure that your app functions as intended across different devices and configurations, ultimately leading to a smoother development and deployment process.