Home » Android » java – android emulator access server in local network

java – android emulator access server in local network

Posted by: admin June 15, 2020 Leave a comment

Questions:

i am having difficulties to have my android app running in the emulator to connect to servers in my local network.
i am getting a

java.net.UnknownHostException

but the servers are resolvable fine from the machine where the emulator is run.

thanks for any help on this topic!

How to&Answers:

You have to use 10.0.2.2 to access local server.

Answer:

Try adding <uses-permission android:name="android.permission.INTERNET" /> to your manifest. This allows your application network access.

More can be found here.