如何修改Genymotion虚拟机的设备标识符(厂商/型号等)?需修改哪些文件?
Hey there! Modifying device identifiers in Genymotion to mimic a real physical phone is totally achievable—let’s walk through the exact steps, files to edit, and key fields you need to tweak:
Prerequisites
First, make sure your Genymotion virtual machine (VM) is completely shut down (not just suspended). Then locate your VM’s storage directory—this varies by OS:
- Windows:
C:\Users\<YourUsername>\AppData\Local\Genymobile\Genymotion\devices\<UniqueDeviceID> - macOS:
~/Library/Application Support/Genymobile/Genymotion/devices/<UniqueDeviceID> - Linux:
~/.Genymobile/Genymotion/devices/<UniqueDeviceID>
<UniqueDeviceID> is a random string folder name assigned to each VM—you can identify it by checking the creation date or matching it to the VM name in Genymotion’s interface.
Step 1: Edit the VM’s Hardware Configuration (.vbox File)
This XML file controls the VM’s basic hardware metadata. Open it with a text editor (like Notepad++, VS Code, or TextEdit) and modify these attributes:
- In the root
<Machine>tag:manufacturer: Set to your target brand (e.g.,manufacturer="Samsung")model: Set to the public model name (e.g.,model="Galaxy S23 Ultra")
- Inside the
<Hardware>→<System>tag:product: The device’s internal model code (e.g.,product="SM-S918U")vendor: Repeat the manufacturer name (e.g.,vendor="Samsung")version: The Android OS version (e.g.,version="Android 13")
Pro tip: Always make a copy of the .vbox file before editing—if you mess up, you can revert to the backup.
Step 2: Tweak Android System Properties (build.prop)
The build.prop file is where Android stores core device identification data. To edit it:
- Start your VM and connect to it via ADB (Genymotion usually auto-configures ADB, but double-check in Settings → ADB).
- Run these commands to make the system partition writable:
adb root adb remount - Pull the
build.propfile to your local machine:adb pull /system/build.prop - Open the local
build.propfile and modify these critical fields (replace values with your target device’s info):- ro.product.brand: Short brand name (e.g.,
ro.product.brand=samsung) - ro.product.manufacturer: Full manufacturer name (e.g.,
ro.product.manufacturer=Samsung Electronics) - ro.product.model: Public model name (e.g.,
ro.product.model=Galaxy S23 Ultra) - ro.product.name: Device’s internal codename (e.g.,
ro.product.name=galaxy23ultra) - ro.product.device: Device’s hardware code (e.g.,
ro.product.device=SM-S918U) - ro.build.fingerprint: Most important field—this is the device’s unique identity fingerprint. Use a real value from the target device (you can get it by running
adb shell getprop ro.build.fingerprinton a physical phone). Example:ro.build.fingerprint=samsung/galaxy23ultra/SM-S918U:13/TQ3A.230805.001/230810.001:user/release-keys
- ro.product.brand: Short brand name (e.g.,
- Push the modified file back to the VM:
adb push build.prop /system/ - Reboot the VM to apply changes:
adb reboot
Note: On newer Android versions (10+), some properties might be stored in /vendor/build.prop or /odm/build.prop—check those files too if your changes don’t show up.
Step 3: Verify Your Changes
Once the VM restarts:
- Go to Settings → About Phone to confirm the manufacturer, model name, and OS version match your target device.
- Run
adb shell getpropin your terminal and search for the fields you modified to ensure they’re applied correctly.
Key Notes to Avoid Headaches
- Backup everything: Always save copies of
.vboxandbuild.propbefore editing—mistakes can brick your VM. - Avoid exotic devices: Stick to mainstream phone models (like Samsung Galaxy, Google Pixel) to minimize app detection issues.
- Watch for resets: Some Genymotion updates might overwrite
build.prop—disable automatic VM updates if you want your changes to persist long-term.
内容的提问来源于stack exchange,提问作者Flavius Valens Augustus

