Automatic server discovery for Android

Code from @jameslennon321 migrated to Gradle-compatible structure.