As eldarerathis variant didn't work out for me, and I didn't want to install an app just for that, I've found a different way. Only possible drawback: It requires root.
adb shell
$ su
# cd /data/data/com.android.providers.settings/databases
# sqlite3 settings.db
sql> select * from secure where name='android_id';
26|android_id|1234567890abcdef1
The android_id
is found in the third column here (anonymized in the example).
EDIT:
Note that this is NOT the android_id
used by the Google apps. Google seems to have decided for some confusion here. For Play Services, there's a separate android_id
stored by GTalk, as pointed out by a blog post (also see this answer by HassleFixes, who is the autor of StripSearch, and thankfully pointed this out in the comments):
- call up your dialer
- dial
*#*#8255#*#*
- watch out for "Device ID"
- remove the leading
android-
- what remains, is the
android_id
used by Google Services
I've verified that: the android_id
retrieved this way works fine on a device with no Google-Apps installed (used with the BlankStore provided by the NOGAPPS project).