• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Forcing Android ID same in all builds of same app

String androidID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);

I can build
- debug APK
- release APK
- debug bundle
- release bundle

Only first one and last one are interesting.

Even if in build.gradle reads

buildTypes {
debug {
signingConfig signingConfigs.release
...
}
release {
signingConfig signingConfigs.release
...
}
}


debug APK and release bundle (after installing from Google Play Store) have different Android IDs in same phone.
Google Play state (internal testing, closed testing, open testing, production) doesn't matter, does it?
 
Upvote 0
I see now.
The Android ID is related to developer signing key.
As we know, Google Play Store will re-sign uploaded release apks/bundles. So the app you installed from Google Play Store will have a different signing key from which you used to sign the debug apk.
As a result, debug APK and release bundle (after installing from Google Play Store) have different Android IDs in same phone.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones