Facebook can’t be installed. Error code: -504 on Android. How to fix?

Trying to install the Facebook app for Android many users encounter the following error:

Can't install app
"Facebook" can't be installed. Try again, and if the problem continues, get help troubleshooting. (Error code: -504)

Here you can find the solution that worked for us.

Read moreFacebook can’t be installed. Error code: -504 on Android. How to fix?