I have a Google Pixel 7 which I'm using for Android app development. I'm using it on 2 PCs, in both environment the phone produces the very same errors:
When I connect it via USB cable it keeps popping up the "Allow USB debugging" dialog no matter that I check the "allow" checkbox. Sometimes it keeps popping up 3-4 times in a minute which also results in a lost connection making development impossible.
QR code wireless pairing with Android Studio rarely works. Like 1-2 times from 10 tries, and it also loses connection in a few minutes. Same results with wireless connection using the "connect with code" option.
Conculusions so far:
I experience all of the issues in both environment which makes me think the problem is not with the PCs and its softwares.
The connection issues appear in both wireless and usb debugging which makes me think the phone itself has some built in error.
I tried all the solutions listed on other questions/answers in stackoverflow, also those issues are slightly different.
Please help if you can.
Android Studio has some problem for connecting devices through Wireless Debugging (QR code/Code pairing) which is evident on issue tracker page https://issuetracker.google.com/issues?q=status:open%20componentid:824897&s=created_time:desc.
But regarding USB debugging, I would suggest you try a different cable, if that doesn't work, try using a different device.