None of the other solutions floating around the internet worked for me (Chinese VPN, Disabling MIUI optimization...). I also could not temporarily sign into a Mi account, since I'd uninstalled as many MIUI system apps as I could and thus sign-in wasn't working anymore (and I just didn't want to sign in to begin with).
YMMV - it worked for me when I did it in early 2019, but it may not work any more if they changed something. I changed to custom ROM and can't test it anymore.
If you want to change it back, just re-run the commands with a 0
at the end and remove what you added to the text files.
This requires root, shell access with su
, and a way to edit text files as root. I used Termux and and an android root file manager that can edit text files.
First, run the following command (su
first, to switch to root):
setprop persist.security.adbinstall 1
If you also want to enable "USB debugging (Security settings)", for granting permissions, simulating UI input, etc. via ADB, run the following command too:
setprop persist.security.adbinput 1
Next, we need to edit the file
/data/data/com.miui.securitycenter/shared_prefs/remote_provider_preferences.xml
so that MIUI actually lets us do these things:
Add the following line to the XML file (with all the other ones, before the closing tag, or change it to true if the line is already there):
<boolean name="security_adb_install_enable" value="true" />
Or, if the line is already there, you can can use sed
to change it from false
to true
:
sed -i 's,"perm_adb_install_notify" value="true","perm_adb_install_notify" value="false",' /data/data/com.miui.securitycenter/shared_prefs/remote_provider_preferences.xml
No reboot necessary. MIUI annoyingness circumvented :-)
adb install app.apk
useadb push app.apk /sdcard/
and then tap the apk from a file manager on the device to follow the usual side-loading install. Of course, Unknown sources must be enabled in settings. Not a solution per se, but a cheap workaround.