问题
I have a problem and it is that, yesterday, I could access from my mobile phone to my computer network but today it doesn't work. Why it could be?
What I have ready:
- I have running my local server with XAMPP (I have started
Apache
andMySQL
). - I'm connect via WIFI to the same network.
- My mobile phone it's connect to the computer via USB.
- I went to
CMD
, copy theIP
of my computer and put it on the browser of my mobile phone, but it doesn't work. - I tried with the url
10.0.2.2
but it also doesn't work.
Why it could be? Yesterday it worked perfectly putting my url in my mobile phone browser and today it doesn't work. I didn't make any change from yesterday. Had I forgot something? How can I check that all it's working correct?
Note: I saw a lot of questions that makes the same question but I couldn't solve my problem with them.
Thanks in advance!
EDIT: I saw a problem in my log console. The log it's here:
06-04 16:49:21.527 17600-17600/com.example.user.project V/PhoneWindow﹕ DecorView setVisiblity: visibility = 0 ,Parent =ViewRoot{420a1478 com.example.user.project/com.example.user.project.MainActivity,ident = 0}, this =com.android.internal.policy.impl.PhoneWindow$DecorView{4205a608 V.E..... R.....ID 0,0-0,0}
06-04 16:49:21.527 17600-17600/com.example.user.project D/ActivityThread﹕ ACT-LAUNCH_ACTIVITY handled : 0 / ActivityRecord{4204b3c0 token=android.os.BinderProxy@4204aa68 {com.example.user.project/com.example.user.project.MainActivity}}
06-04 16:49:21.590 17600-17600/com.example.user.project E/﹕ appName=com.example.user.project, acAppName=/system/bin/surfaceflinger
06-04 16:49:21.590 17600-17600/com.example.user.project E/﹕ 0
06-04 16:49:21.590 17600-17600/com.example.user.project E/﹕ appName=com.example.user.project, acAppName=/system/bin/surfaceflinger
06-04 16:49:21.590 17600-17600/com.example.user.project E/﹕ 0
06-04 16:49:21.592 17600-17600/com.example.user.project D/GraphicBuffer﹕ create handle(0x614af178) (w:480, h:800, f:1)
06-04 16:49:21.593 17600-17600/com.example.user.project I/MaliEGL﹕ [Mali]window_type=1, is_framebuffer=0, errnum = 0
回答1:
This is a solution that I found to make it works when this trouble happens. It is not technical (or I don't think so) but it works for me and it's the following:
- I connect my mobile device to the computer via USB.
- I run my server (in my case XAMPP).
- I'm connect via WIFI to the same network from my mobile device as from my computer.
- I went to
CMD
, copy theIP
of my computer and put it on the browser of my mobile phone, but it doesn't work.
If I do the steps that I put above it doesn't work. So, what I have to do to solve this problem?
When I have configurated all the steps that I put above and this error ocurrs, I have to disable the WIFI from my mobile device. When I enable it again it works perfectly!
I don't have any idea about why it happens, and I know that it's not a very technical answer but I mark as accept because I think it can help another people.
If some of you have another solution to this problem or if you know why it is correct with my solution please let me know.
回答2:
When you use a wifi network to communicate you don't need connecting the usb cable except of using usb debugging. I suggest the following solutions:
- Turn the windows firewall off. (or other antivirus firewalls or proxy softwares)
- Change your system IP address manually and use it in the android.
- Stop and start XAMPP. (If possible change the XAMPP default port).
- Check your mobile proxy setting. (you can simply forget the wifi and reconnect it).
Also to be sure if problem is from your PC or not you can use a second PC or Laptop and open the webpage from a browser.
回答3:
If the site isn't reachable locally (it's not clear from your question), it might be that Apache isn't really running. One common scenario is that Apache crashes, leaving behind a httpd.pid
file indicating that Apache is still running even though it's not. This could explain why the error seems to occur randomly. Stop Apache, remove httpd.pid
(possibly located at /opt/lampp/logs/httpd.pid
) and start Apache again. Also, check the Apache log for errors. (The error log can be found in the <xampp-install-location>/apache/logs
directory.)
来源:https://stackoverflow.com/questions/30643538/why-my-access-from-my-mobile-to-my-computer-network-doesnt-work