I am using Android Studio 2.2 Preview. I am facing the issue
Failure: Install failed invalid apk
Error: While installing apk,
If your device is a Xiaomi
Solution for my specific case:
Maybe it has happened because you have installed your apk first by the Google Play (my apk was running OK until I found an error) and then trying to reinstall it from your Android Studio (in order to figure it out), I have a solution:
Go to your phone/tablet. Settings -> Backup & Reset -> Disable Automatic Restore
I hope it works :)
Below solution worked for my Xiaomi mobile phone:
Go to Settings -> Additional settings -> Developer options and check Install via USB, if toast The device is temporarily restricted shown, please turn your WI-FI off, turn on mobile data. Then try it again.
If A.S. Instance Run is still not work when you finished all steps above, perhaps you turned on MIUI optimization, please follow below step and try again:
Settings -> Additional settings -> Developer options and uncheck Turn on MIUI optimization
I had same problem in my xiaomi note 4a device. I solved it by turning off MIUI optimization.
Android Install on Device Failure [INSTALL_CANCELED_BY_USER] **Redmi Note 3
Go to Settings -> Permissions -> Install via USB: Uncheck your App if it's listed.
Go to Settings -> Additional Settings -> Privacy: Check the Unknown Sources option.
Go to Settings -> Additional Settings -> Developer options: Check the Install via USB option.
Go to Settings -> Additional Settings -> Developer options:Enable view attribute inspection
Finally Go to Settings -> Additional Settings -> Developer options:Turn off MIUI optimization.
NOTE - Signin in to MI account is required to enable Install via USB option.
Ref: http://en.miui.com/thread-410773-1-1.html
Try this: Go to File> invalidate Caches/Restart then click on Invalidate and Restart button from the pop up. Now, try running your project.