TLDR; The Fix: Plug your Pixel 2 into a USB 2.0 port, not a USB 3.0 port.
If your Pixel 2 device will not connect to ADB (Android Debug Bridge) with a USB cord then you might want to check the port that it is plugged into. I’m using a USB-C to USB-A cable, in fact, I even went and bought new cables because I assumed my problem was with cables – nope.
Some Pixel 2โs will not connect over USB 3.0, you will need to connect it to a USB 2.0 port. In my case, I decided to use a USB 2.0 hub that I had lying around. As soon as I connected the phone to a USB hub (which was, in turn, connected to my MacBook Pro), everything was golden.
I connected it, the Pixel 2 device recognized I was connected and prompted me to trust the computer. At that point I was able to see the device with adb devices
from the command line and from within Android Studio. ๐
This issue was reported in December 2017 and unfortunately it has not been fixed. I say unfortunately because if I were a new developer learning to code Android, this could be a supremely frustrating experience and could deter myself (and many people) away from Android development. First time experience is key.
I hope that helps!
Happy coding.