Xiaomi for developers

Xiaomi is a great phone brand, outstanding performance and price with a good finished, however is a little bit tricky for developers: some options are not at first sight and you have to check extra permissions.

Similar to other Android phones first of all you have to enable Developer Options:

  1. Settings
  2. SYSTEM & DEVICE / …Aditional settings
  3. Developer options
  4. Switch On:
    1. Developer options
    2. Stay awake (recommendation)
    3. USB Debbuging

Extra for Xiaomi:

1. Switch On Install via USB: it will make you activate your Mi Account using your phone number. If you don’t do it, you will not be able to debug/install your app and will get an error as follow:

Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]

2. USB debbuging (Security settings) will open 3 Important Warning dialogs with a default timer (countdown) to make you read it before press Next. At the end, if you haven’t rejected them the option will switch on. If you don’t do it, you will not be able to debug/install your app and will get an error as follow:

Failed to execute shell command "input,keyevent,82"" on device: Error: adb: Command failed with exit code 137

Note: I’m developing with Apache Cordova and Xiaomi Mi.