Turn on your usb debugging, then in developer options go for last item name is 'Turn on MIUI optimization', turn off this option it will ask for reboot , then reboot device by clicking Turn off & reboot button
after reboot go to Setting->Permissions click on top right menu button Turn on install via USB option
In MIUI 8.5 it gives the error like you mention while enabling "install via USB", to resolve the error you need to make WIFI off and make mobile data on and then enable the option “Install via USB”. it will work for you.
I had the exact same problem, tried all the suggested workarounds, but none of them worked for me. Strangely enough, what actually has worked for me was turning on MIUI optimization (it was turned off when the problem occurred)! After turning it on, I was able to toggle on install via USB.
I tried everything to no result, then read somewhere that you should use VPN and connect under China to unlock your phone's bootloader. Applied the same solution here and it worked!
The Best what I found devices without mobile data in device is to SIGN_OUT from MI_Account in the device and Login Again -> Try to enable USB_Debugging(Security Setting)-> enable INSTALL_VIA_USB
"Install via USB" wont work if your Xiaomi phone is running MIUI 8 or above. Looks like when you try to Enable this option, your phone trys to connect to some chinese server and fails.
I got a work around and it worked for me. Idea is to connect to Chinese-Shanghai server through VPN. Try the following:
Install PlexVPN from Playstore and login into it. You will get a 24 hr free VPN service.
Select China-Shanghai server and connect.
From developer option in your Xiaomi phone, Enable "Install via USB".
You can then disconnect the VPN and logout from PlexVPN.
go to Settings->Accounts->MiAccount->AccountSecurity->Devices
I had a Redmi 9 device listed there (I don't own a Redmi device)
I removed that Device, so now no devices were listed
go back to developer settings, enable install via USB, everything works.
I assume not everyone will have a Redmi device listed there, maybe some will have a different device, maybe some will even have the correct device(this is not something I can test by myself), but it makes sense to me that correcting any wrong devices from that list (or maybe deleting all devices like I did) might fix the problem.
I got this problem in my Xiaomi Mi5 from India. All the mentioned solutions didn't work in my case. Then I tried to figure out the Core reason behind it and solve it. In MIUI, in order to change "Install via USB" option, you must be connected to the internet and signed in your Mi account. Due to some reason, requests from out of the China servers are getting rejected, so I connected to one open China VPN and tried again to enable 'Install via USB' and I got success. For detailed solution and VPN details, see this useful Youtube video: https://youtu.be/MeKUJlD-Ke4
Turning off Wi-Fi and enabling Mobile Data (thank you Xiaomi for wasting my money to enabling mobile data which the last one I didn't have) on Xiaomi 4A did not work for me. Every time I tried to enable Install App Via USB it displayed me "the device is temporarily restricted". So, I found this solution:
Turn on VPN onto your device with these parameters and try again toggle Install from USB:
Server Address: China server from https://www.vpngate.net/en/
In my case,I was using my phone that is Redmi 4 and the usb debugging was not working.It was always giving the message "the device is temporarily restricted" .I have tried all this steps but the result was same.Then I found the foolish thing that I have put the device in charging mode only.When I switch to MTP(Transfer files) and then it started working correctly.I know its a foolish thing but it may help to someone.
For me, options like Turning WiFi off & on, trying on Data Network, or Turning off MIUI Optimization din't work.
Also, the Install via USB never got enabled.
Following steps helped me to install apps via USB
Additional Settings > Developer Options
Here, click on USB Debugging (Security Settings). This will take you through some warning screens. Allow (click on Next/Accept) for all. At the end, it will be enabled.
Now turn on the Install via USB and it gets enabled.
Try to Run the app by connecting your device. If it still doesn't run (as in my case), find Select USB Configuration and select Charging
This worked for me.
These steps worked for me after struggling 1 hour, Not needed to connect to Chinese server.
(1) Turn Off your Wi-Fi
(2) Turn Off your Mobile Data
(3) Turn On "Install via USB" from Developer Option of your device.
4) It will show the Error "No network found"
5) Now Turn On your Mobile Data
6) Again Turn on "Install via USB"
7) it will work, now
Happy!
In my case when i updated MIUI version to the new available version, resolved the issue.
So check if there is any update available for your device, go to
Settings => About phone => System update
=> here it will shows you the new available MIUI version for your device. So update it then try again.
Note: Turn your Mobile data before enabling install via USB.
I have tried every method mentioned here but unfortunately none were worked for MI 5A .
Finally i have succeeded by connected to open china VPN
settings->VPN->add new VPN->
Name:Give some name ,
Type:L2TP/IPSec PSK ,
Server address: vpn601519347.opengw.net ,
IPSec preshared key :vpn ,
User name :vpn ,
Password :vpn .
Press OK, Enable VPN
once the connection is successful
go to developer option and enable install via USB option.
You can also try different server address like
china088.opengw.net ,
vpn959922015.opengw.net
You will need to sign up/sign in for a Mi account before you continue.
1) Extract sim card from your non-Redmi phone. (It should be nano sim. Contact your telecom provider to get one if you have a micro or normal sim).
2) Insert sim card into Redmi phone.
3) Go to Settings -> Additional Settings -> Developer options.
4) Under Debugging, click on 'Install via USB' option.
The phone will enable this.
Remove the sim card.
That's it!! You should now be able to install your apps via USB from Android studio.
Please remember not to disable this option, otherwise, you may need to re-insert your sim card.
PLEASE NOTE: The above steps are guaranteed to work in Xiaomi Redmi 5 phone. Please improve this answer if the steps are different for other models of Xiaomi.
If you are not able to disable MIUI optimization as suggested by other users
All you got to do is head over to Developer options and tap on “Reset to default values” a few times. And the miui optimization will appear