Make sure that the value of gcmSenderId still has the trailing backslash
A hint for anyone googling for this: make sure that the value of gcmSenderId
in your AndroidManifest.xml
still has the trailing backslash (\) after you’ve changed the project number to your own. Otherwise the value gets interpreted as int, when it should be a string, which is one way to trigger the issue of devices being assigned empty/null IDs.
(The building instructions do have this documented in bold, but it’s still very easy to miss, I know I did. Complicating the debugging was my Nexus 5X, which kept getting a proper device ID even when all other devices using the same broken build failed to.)