无法使用Android USB设备调试Android应用 [英] cannt debug android app with android usb device

查看:88
本文介绍了无法使用Android USB设备调试Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发ASP Web应用程序和android应用程序
ASP服务器在端口6100上运行
我使用我的android设备进行调试
当我运行两个程序时,虽然我在android应用程序中使用了10.0.2.2:6100,但在android应用程序中却遇到了异常,网络无法访问
我搜索问题,发现故障可能是端口转发
我在adb中将命令写为
亚行转发tcp:6100 tcp:5000
有问题:无法绑定套接字
我将命令更改为
亚行转发tcp:5000tcp:5000
并且可以运行,但是android应用仍然表示网络无法访问
有人可以帮我吗?......

i develop asp web application and android application
asp server is running on port 6100
i use my android device for debugging
and when i run two programs i got exception in android app said network is unreachable although i used 10.0.2.2:6100 in android app
i search for problem and i found the sloution may be the port forwarding
i write the command in adb as
adb forward tcp:6100 tcp:5000
and there is problem : cannt bind socket
i change the command to
adb forward tcp:5000tcp:5000
and it run, but android app still said network is unreachable
can anyone help me please?.........

推荐答案

我将不得不猜测这个,因为我不是确定我了解问题所在.

如果您说在模拟器下可以正常工作,并且在通过USB连接的手机上不是,那是因为10.0.2.2是模拟器而不是手机的特殊回送.将手机更改为127.0.0.1或为android应用提供asp Web服务器的地址.

我的理解是,Android默认情况下没有USB系绳,但是可以做到. reverse-usb-tethering-with-android [ ^ ]解释如何做到的.

也许这会有所帮助,我希望如此

/Darren
I''m going to have to guess at this one because I''m not sure I understand what the problem is.

If you saying under the emulator this works and on your phone connected via usb it doesn''t it''s because 10.0.2.2 is a special loop back for the emulator and not the phone. Change the phone to 127.0.0.1 or give the android app the address of the asp web server.

My understanding is there is no usb tether by default under Android, but it can be done. reverse-usb-tethering-with-android[^] explains how it can be done.

Maybe this helps, I hope so

/Darren


这篇关于无法使用Android USB设备调试Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆