I have an iPhone 7 and I lost the headphone jack adapter that came with it (not surprising)

I bought another one from Amazon (offbrand) and after listening to music for around 30 seconds, I get a msg on my phone saying that "this accessory is not supported by your phone," anyway I can fix this?

You have to buy Apple approved adapters. They want you to pay full price for their products. So it's best to buy the expensive Apple brand adapters.