Installation failed

I have been trying to run the hello world app on emulator but it keeps showing the following error:
09/24 12:36:07: Launching ‘app’ on Pixel 2 API 27.
Installation did not succeed.
The application could not be installed.

Check this Stack overflow post. Try all solutions mentioned here.