Just changing the model of the Android device emulator

Prologue

It would seem, at first glance, a very simple task. Some readers could even in those bearded times climb all sorts of 4pd, root their touchscreen Samsung, change the contents of the build.prop file and show naive lamers their iPhone 15+ Max Pro. However, as it turned out, and as it often happens, not everything is so simple and there are pitfalls here. The article is designed to help ordinary workers avoid all the bumps and holes on the way to their goal!





Disclaimer

I will warn you right away that I like to write such articles in some detail, not for the sake of volume and multi-letters, but for the sake of maximum immersion in the problem and the way to solve it. Please note that I am working on macOS , so all commands in the terminal will be oriented for this OS. Also, it should be noted that I am turning all this for API 30 , that is, for the very latest at the time of this writing. As the internet says, the difficulties on this topic began with API 29 .





Why is this needed?

I assume that you, dear reader, have a good reason for this, otherwise you would not have done this. It is most likely that you, like me, have a programmatic check for the device model from which the application is launched, something like here . By the way, in this way it will be possible to check the result of our labors. The second, and easier way to check the emulator model will be through the device settings in the device information section:





. .apk - . . , , , . . , .





The screen did not let me go further

build.prop

, build.prop, system/. , , :









adb root : adb root



. , : adbd cannot run as root in production builds



. - Google :









- Google , adb root



. : restarting adbd as root



. Google , adb root



.





, build.prop:





build.prop

build.prop . :





. .apk . , PIXEL 3A XL ( , ):





. adb push (, adb pull GUI).





: adb push build.prop system/











adb: error: failed to copy 'build.prop' to 'system/build.prop': remote couldn't create file: Read-only file system







! , . , . .





( ):





emulator -avd Pixel3XLAPI30 -writable-system -no-snapshot -nocache







Pixel3XLAPI30 - , emulator -list-avds







 -writable-system - .





-no-snapshot -nocache - , -.





( , ) :





PANIC: Missing emulator engine program for 'x86' CPU.







! , .





.bash-profile ( zsh .zshenv) macOS, . :





export ANDROIDHOME=~/Library/Android/sdk







ANDROIDHOME PATH:





export PATH=$ANDROIDHOME/emulator:$ANDROIDHOME/tools:$PATH







( source ~/.bash_profile



) ( source ~/.zshenv



). echo $PATH



PATH .





.





emulator -avd Pixel3XLAPI30 -writable-system -no-snapshot -nocache 







.





-writable-system:





-writable-system make system & vendor image writable after 'adb remount'





adb remount



. adb root



, adb remount







adb remount



, . adb reboot. . .  adb reboot



. , . . . adb remount







:





  1. adb root







  2. adb shell avbctl disable-verification







  3. shell exit







  4.  adb reboot







  5. adb root



     





  6. adb remount



     





! . build.prop : adb push build.prop system/



. adb reboot



… ...





build.prop

, ro.product.product.name ro.product.product.model , . , build.prop, : system, system_ext, vendor product. , . product. - !





- . …





, ( ). adb root



, adb unroot



. , , - .





, . RootBeer .





step-by-step. , !








All Articles