That sentence is ambiguous. One sense is "the dog [which was] entering the apartment". For that, I'd answer "Il a entendu le chien qui entrait dans l'appartement". Another sense is "heard the dog enter[ing] the apartment". I'm not confident enough to translate that one.