Error 504:
Problem:
App cannot be downloaded due to an error. (504)
Solution:
Method 1:
Go to Settings>> Application Manager or Apps>> open "All" apps
From the list find Google Play Store >> clear data and clear cache
Find Google Service framework(Google Play Services) from the list>> clear data and clear cache
Now install or, update app from Play Store
Method 2:
Navigate to System Settings>> Accounts>> Google>> Remove gmail account
From Settings>> Apps>> All> Force Stop then clear data and cache from Play store, google service framework (google play services) and download manager (like in method 1)
Again go to Settings>> Accounts>> Google>> add your gmail account
Restart your Android device then accept all Google terms and setup Google settings
Re-run Google Play Store and update or, install app.