26

I am trying to create some apps on my xiaomi smartphone (MIUI 8), but when I try to run an app, the error INSTALLATION_CANCELED_BY_USER appears. I found that the problem is that I must enable the "Install via USB" option from developer settings. When I try to do so, I get a screen that says I have to login/signup with an MI account in order to enable this option, which is something I am not willing to do. So, I have 3 questions:

  • Why did they make it neccessary to provide an account for enabling an option like this?
  • Is there any way I can bypass the MI login screen and enable the option?
  • The reason I don't want to connect my phone to an MI account is that I am concerned about personal data being uploaded. Is it a logical concern?
  • 2
    Instead of adb install app.apk use adb 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. – ccpizza Apr 8 '18 at 13:56
10

What I didn't want was to continue having an MI account connected to my device. So I just created a temporary account, enabled the "Install via USB" option and then logged out from the MI account. So, now I hope the option stays enabled :)

  • 13
    Just want to add that in my attempt to enable Install via USB MIUI v9 asked me to insert SIM card. Why Chinese companies collect such information about developers - I can't imagine )) – gavenkoa Jan 6 '18 at 22:43
  • Same as American or any other companies collect information. Whether it is theft of your personal data or improvement of services is up to you to decide. – ADNow Jan 28 '18 at 16:52
  • 3
    @ADNow Xiaomi seems to be going further than most other phone manufacturers, though. My Mi Mix 3 is the first phone I've owned requiring me to sign into the company's service to enable usb app-installation, as well as the first requiring a SIM card to be inserted. They must specifically have added those requirements, and I don't see a legitimate reason why. – Venryx Jul 29 at 7:43
6

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).


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 </map> tag, or change it to true if the line is already there):

<boolean name="security_adb_install_enable" value="true" />

Reboot your device. MIUI annoyingness circumvented :-)

  • 1
    I get Security Center crashed message, when trying to install apk after these actions. – Artem Mostyaev Feb 15 at 14:32
  • @ArtemMostyaev Hmm, maybe this doesn't work for everyone then.. If you can upload a logcat somewhere, I could have a look at it and see if I can figure out why it's crashing. – JonasCz Feb 15 at 16:39
  • Here is the logcat pastebin.com/XAjmqAWq I also deteted miaccount app, maybe I touched something else too.. – Artem Mostyaev Feb 18 at 13:16
  • @ArtemMostyaev It looks like the system can't start the part of the "security center" app that handles this. Did you uninstall the "security center" app, or one of the other "security" apps / components ? Or perhaps you uninstalled some other system app that I didn't, hence it works for me. – JonasCz Feb 18 at 14:56
  • Yes, now I remember. I uninstalled some 'security' app in hope to get rid of that, but the 'security center' still presents on the phone. Looks like ROM reinstall is the only choice for me. – Artem Mostyaev Feb 19 at 7:26
5

"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:

  1. Install PlexVPN from Playstore and login into it. You will a 24 hr free VPN service.
  2. Select China-Shanghai server and connect.
  3. From developer option in your Xiaomi phone, Enable "Install via USB".

You can then disconnect the VPN and logout from PlexVPN.

Enjoy!!

  • I tried this, it still ask me to sign into MI account. – JonasCz Dec 20 '18 at 12:40
5

For those who have already inserted their sim card into the Xiaomi phone, the above answers all would work.

But, if you are using Xiaomi Redmi 5 only for development purposes, you will need to do as per below:

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.

  • 1
    this works with Redmi 6 too – mgear Nov 20 '18 at 11:26
  • This works with Redmi 6A too – ARiF May 12 at 7:17
1

First question: I think it's a bug

Second: The are some workarounds (suggested in Mi forums)

Try the following steps to bypass mi account requirement for USB installation:

  1. Settings > Additional Settings > Privacy: Check the Unknown Sources option.

  2. Settings > Additional Settings > Developer Options > Turn On USB Debugging

  3. Settings > Additional Settings > Developer Options > install Via USB

  4. Settings > Additional Settings > Developer Options > Turn off MIUI Optimization.

  5. Restart your Mobile.

Third: Yes is completely logical and justified to protect your privacy, you never know the 'intruders'

Acknowledgements

  1. Install Via USB not working - The device is temporarily restricted
  2. Android Install on Device Failure [INSTALL_CANCELED_BY_USER]
  • 3
    Thank you for your answer, but my main problem (bypassing MI sign in) wasn't solved. When I try to check the install via USB I still get the sign in page. I checked the links you provided but I did'n manage to enable install via USB. – Thanasis1101 Nov 5 '17 at 17:31

protected by Community Sep 15 '18 at 0:25

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.