Error 504 when downloading apps from Play Store?
According to the list of status codes at Wikipedia, a 504 error means the following:


  504 Gateway Timeout
  The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.


In other words: the culprit should neither be (on) your device, nor (at) Google Play -- but in between.

A thread on the Nook forum describes the very same problem, and one of the conclusions there is:


  Generally, that means a Gateway error and I would suspect the problem being on the router end rather than the Nook side. Sometimes a router reset will cure it.


Which corresponds to my conclusion. So if you're using mobile data, it might help to switch data off and on again (or better: switch to airplane mode and back), in the hope you will get a connection into a different segment of your provider's network (and thus a different gateway on that end).



From a thread on XDA about all the Google Play Error Codes


  Method 1:   
  
  
  clear data  
  clear cache of google play store &amp; google service framework
  
  
  Method 2:  
  
  
  remove your gmail account 
  reboot 
  Re-add account 
  




Funnily, the very same issue comes to a very different conclusion on Yahoo answers: here the user had not enough space on his device, so after removing some other app it suddenly worked. I suspect this was a co-incidence (when he tried again after having freed up space, the gateway was "fixed") -- but it cannot hurt to check for that.



Several more sulutions might pop up with the time. To me it proved helpful to search Google for '"Google Play" "error 504"'.