Dog hates me.... 😢

I have been trying for 2 years to build a bond with my husband's dog and he just hates me no matter what I do. I have spent hours upon hours of personal bonding time with him, I've been training him, walking him, taking him to the vet, spoiling him and treating him and feeding him. He still hates me. He won't come inside if it's me that opens up the door after he goes potty, he hides under the deck from me. I mean he gets excited when I come home and he will listen to me while inside and come to me inside, but doesn't when outside. I don't know what else to do. Any tips or ideas would be greatly appreciated!! He is old, he is 11.