I have read many terrible articles about how to change the hostname of an Android device (the one that is shown on your Wifi access point and usually consists of “android-” followed by a hash of the mac address). What all these articles have in common is that they only work on a few devices (if at all) and some of them require you to make intrusive changes to your operating system.
Long story short, here is the proper way to change an Android hostname on all recent Android devices. The change will be persistent after reboot and will not require you to install busybox or init.d mods and the like.
You will need to make changes to the system partition. Therefore the partition will have to be re-mounted read/write. You could use adb tools with USB debugging to remount your partition and echo the changes into the appropiate file. This will not work on devices with safe boot etc. So either way, you will end up rooting your device (or atleast make changes required for rooting a device) so to make things short, let's make a rooted device a requirement (it's a requirement in all other articles too).
The easiest way to change your hostname is by using ES File Explorer. We will have to edit the build.prop file. Please note that many build.prop editor do not allow adding a new line so you're on the safe side with ES File Explorer. This software can remount the system partition and has a built-in editor to make changes and add to configuration files.
Open ES File Explorer, click on the upper left world symbol so that a menu opens on the left of the screen. Scroll down until you find “Root-Explorer”. Enable Root-Explorer (click on the ON button) and then click on the “Root-Explorer” text itself until a white dialog opens and then click on “Mount R/W”. Now check “RW” for /system and click on OK. Your system partition is now ready for modifications.
Back in the file explorer click on the “/” button on the top of your screen to navigate to the root directory. Now click on the “system” folder to navigate into this partition. You will find a build.prop file, click it and use the built-in ES editor to open this file. You will now see a text file with a lot of properties. Scroll down to the bottom, click the “…” symbol in the upper right corner and then on “Edit”. Now append the following line:
Now click the back button and you will be asked to save the file.
Click on the world symbol again, click on “Root-Explorer” in the menu, now check “R” for /system (so that the partition is no longer mounted read/write), and then turn off “Root-Explorer” in the same menu by clicking the “On” button. You can now close ES File Explorer. You're done.
For this change to become effective (and to test if it works persistently after a reboot) simply reboot your device. If everything works, you may uninstall ES File Explorer afterwards. Now log into your AP and verify that you are now using your new hostname.