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.
# cd /data/data/com.android.providers.settings/databases
# sqlite3 settings.db
sql> select * from secure where name='android_id';
android_id is found in the third column here (anonymized in the example).
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
- watch out for "Device ID"
- remove the leading
- 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).