If you're developing an Android app which requires any kind of server you probably have to update the IP address of your local testing server every time you start developing.
Since as developers we don't want to do things more than once, we need to automate that. Luckily with the awesomeness of Gradle and the help of a custom field in the BuildConfig we can solve that.

Define a function which finds the interface by name and returns its ip address. On Linux systems the name will probably be something like eth0 or wlan0. Add buildConfigField to your defaultConfig and call getLocalIp(...). Maybe create a little utility method(getHost) to check whether it's a development version or we're running on an emulator.

Solved. From now on you don't have to be concerned about the guy who always commits his local ip and overwrites yours.