Our Xiaomi Mi A1 is locked and needs to be unlocked before flashing anything.
1. Power off your handset.
2. Press and hold volume down button and connect the handset to the pc/laptop.
3. Handset will now enter into fastboot mode.
4. Open command prompt on your pc/laptop and run the following command:
fastboot oem unlock
5. Your phone will be unlocked.
*** Make a backup of all your data as it might get erased during the process***
After you unlock the device, it will become less secure. Your personal data might be leaked or lost.
Please think twice before flashing your phone and do it at your own risk.
Credits: Google and Xiaomi