本文介绍了androidviewclient-无法通过端口转发连接到vm上的设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将vm上的localhost转发到具有80端口(8080 ip:80)的主机,在此之前avc可以正常工作,现在我在连接设备时出错:
I forwarded localhost on vm to host machine with 80 port (8080 ip:80), avc works fine before that and now I have an error with connecting to the device:
import sys
import os
try:
sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src'))
except:
pass
from com.dtmilano.android.viewclient import ViewClient
device, serialno = ViewClient.connectToDeviceOrExit(verbose=False)
def init():
global device
return device
错误:
Traceback (most recent call last):
File "launcher.py", line 5, in <module>
import device
File "/home/test/www/ANDROID/device.py", line 11, in <module>
device, serialno = ViewClient.connectToDeviceOrExit(verbose=False)
File "/usr/local/lib/python2.7/dist-packages/androidviewclient-7.0.4-py2.7.egg/com/dtmilano/android/viewclient.py", line 1436, in connectToDeviceOrExit
device = adbclient.AdbClient(serialno)
File "/usr/local/lib/python2.7/dist-packages/androidviewclient-7.0.4-py2.7.egg/com/dtmilano/android/adb/adbclient.py", line 89, in __init__
self.__connect()
File "/usr/local/lib/python2.7/dist-packages/androidviewclient-7.0.4-py2.7.egg/com/dtmilano/android/adb/adbclient.py", line 129, in __connect
raise RuntimeError("ERROR: Connecting to %s:%d: %s.\nIs adb running on your computer?" % (self.socket, self.port, ex))
RuntimeError: ERROR: Connecting to <socket._socketobject object at 0x7f22a2a2ac20>:5037: [Errno 111] Connection refused.
Is adb running on your computer?
test@ubuntu:~/www/ANDROID$ adb devices
List of devices attached
4d009a1a0ff93183 device
我该如何解决?
推荐答案
已解决-我在hosts文件中将localhost更改回127.0.0.1,从而解决了问题...
Solved - I changed localhost back to 127.0.0.1 in hosts file and it solves an issue...
这篇关于androidviewclient-无法通过端口转发连接到vm上的设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!