The method for connecting a real machine to a local PC server is as follows:
Set the LAN, and the mobile phone accesses a server in the LAN through WiFi (with a lan ip address)
Background:
The Android mobile phone obtains data for display by accessing the Tomcat service on the local PC, and also submits data modifications.
Originally, the connection method 10.0.2.2 was used for simulator development. But the real machine does not work.
Because the development efficiency and speed of the simulator are not as good as those of the real machine, you must build a program that can debug and run AndroidProgramEnvironment.
Specific hardware requirements:
(1) A mini TP-LINK router.
(2) a direct connection network cable.
(3) A notebook with a wireless network card.
Software requirements:
(1) myeclipse8.5
(2) Tomcat server.
(3) Java Web server.
(4) Android mobile client.
Note:
The IP address used by Java Web programs is 192.168.1.100, which is the IP address of the wireless router. Because the wireless router and PC are the same machine.
The installation process is described as follows:
(1) install a wireless router:
(2) connect a local PC to a wireless network:
(3) connect your Android phone to the wireless network.