I want to change the IMEI of an android virtual device that is running on android studio's emulator. It seems that google provides all virtual devices with the same IMEI (358240051111110), so apps that identify users by IMEI have trouble running on virtual devices.
I tried to hex edit the binary of the emulator but had no luck as I couldn't find the hex for the IMEI. I also tried searching on Android Code Search for IMEI
for the 358240051111110
itself in hex and decimal so that maybe I could change the value and rebuild.
Most question I found asking this were old and outdated and no longer work on newer apis (API 26/android 8.0 and above).
It seems adb doesn't have the ability to set or change the IMEI. fastboot however seems to have an option to change it using:
fastboot oem writeimei 123456789012347
However you can't seem to boot into fastboot as Android Emulator does not support recovery mode, just normal boot mode.
There are emulators like MEmu
that have changing IMEI as a feature but I prefer to use Android Emulator as I couldn't find an alternative that has the change IMEI feature along with all the Android Emulator features.
EDIT:
I also tried to run SuperSU on a android 7.1.1 by following this tutorial and this StackOverFlow Answer, I did the exact same instructions but still couldn't get SuperSU to work so that I could maybe use an app to change the IMEI (it would always just brick the emulator on the android loading screen).