Android Application Network Error failed to connect

后端 未结 2 761
梦毁少年i
梦毁少年i 2021-01-21 21:10

I\'m using the following coding to connect locally on my SQL database

String driver = \"net.sourceforge.jtds.jdbc.Driver\";
Class.forName(driver).ne         


        
相关标签:
2条回答
  • 2021-01-21 21:42

    If you are referring to a localhost from your device than use the http://10.0.2.2:8080/ instead of the http://127.0.0.1/ or http://localhost/.

    Because your Android emulator is running on a Virtual Machine(QEMU) and you can not connect to a server directly running on your PC.

    And If you running your app from Physical android device then please use your network ip from your PC. for example http://198.10.12.21:80/....

    Also make sure that your device and PC(from where you call localhost) within same Network

    0 讨论(0)
  • 2021-01-21 21:53

    I fix this error. I was working on jtds driver v1.3.1. When I'm using the older version it works. I'm using now v1.2.5

    0 讨论(0)
提交回复
热议问题