'The application could not be installed: INSTALL_FAILED_USER_RESTRICTED

02/21 08:38:52: Launching 'app' on Xiaomi Redmi Note 7 Pro.
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_USER_RESTRICTED
Installation via USB is disabled.

The USB Debugging is ON and so is the Install Via USB and File Transfer I didn't have this problem till now. The weird part is that Other apps can be installed the same way over USB but this particular app isn't happening I have tried restarting both my PC and Phone

I tried installing it in another phone and still shows the same error while other apps are being installed without a problem



Solution 1:[1]

I turned off MIUI Optimization and restarted my phone and it worked. Really cant understand why

Solution 2:[2]

Working fine after disable the MIUI Optimization option in Xiaomi. Now I am not getting the popup.

Solution 3:[3]

Mostly check the targetSdk version in the android.defaultConfig:

defaultConfig {
    applicationId "com.matukadevelopers.todo"
    minSdk 23
    targetSdk 32
    // targetSdkPreview "Tiramisu"
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

replaced targetSdkPreview "Tiramisu" with targetSdk 32 and it worked.

Solution 4:[4]

For Poco M4 5G in Developer options, enable Install via USB.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Akash R
Solution 2 Varun RTR
Solution 3 Joseph Wambura
Solution 4 Lejla