java.net.UnknownHostException: Invalid hostname for server: local
What the exception is really saying is that there is no known server with the name "local". My guess is that you're trying to connect to your local computer. Try with the hostname "localhost"
instead, or perhaps 127.0.0.1
or ::1
(the last one is IPv6).
From the javadocs:
Thrown to indicate that the IP address
of a host could not be determined.
127.0.0.1
or ::1
or "localhost"
should always be the loopback interface, so if that doesn't work I'd be really surprised.
If there really is a server called "local" on your network - examine your DNS settings or add it to your hosts file.
java.net.UnknownHostException: Unable to resolve host url: No address associated with hostname and End of input at character 0 of
I encountered this problem too, reconnecting the WiFi can solve this.
For us ,we can check if the phone can resolve the host to IP when we start application. If it cannot resolve, tell the user to check the WiFi and then exit.
I hope it helps.
Related Topics
Can't Run Junit 4 Test Case in Eclipse Android Project
How to Include the Spongy Castle Jar in Android
Wrong Version of Keystore on Android Call
Difference Between Google() and Maven { Url 'Https://Maven.Google.Com' }
How to Persist Permission in Android API 19 (Kitkat)
Runtime.Exec():Reboot in Android
Open Gallery App from Android Intent
How to Get String Response from Retrofit2
Android: How to Use Download Manager Class
Transformexception Duplicate Entry for Common.Annotations.Beta
Polygon Touch Detection Google Map API V2
Multiple Dex Files Define <My Package>/Buildconfig, Can't Find the Cause:
Binary Xml File Line #0: Error Inflating Class Imageview
Boot_Completed Not Working on Android 10 Q API Level 29
Gson Expected Begin_Array But Was Begin_Object