Search code examples
androidandroid-studiobuildredmi-device

Building app for Redmi 4 returns error


When I build my app for the phone Xiomi Redmi 4 it shows an error, asking to uninstall the previous app data. But I built the app for the first time.

Error:

Installation failed with message Failed to establish session. It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing. WARNING: Uninstalling will remove the application data! Do you want to uninstall the existing application?

enter image description here


Solution

  • Go to developer options in settings and disable MIUI optimizations. It'll ask you to reboot and it should work after that.