请问大家,在android中如何发布、启动ViewServer服务啊???ViewServer服务端口号是:4939请大家帮忙看看,解决给分。

解决方案 »

  1.   

    1 adb devices
     
    假设我们有多台设备连接在PC上,该命令的输出为:
     1 List of devices attached  
    2 emulator-5554   device 
    3 emulator-5556   device
     
    以设备emulator-5556为例,接下来我们把它的4939端口映射到PC的4939端口上:
     1 adb -s emulator-5556 forward tcp:4939 tcp:4939
    如果连接了多台Android设备,HierarchyViewer将把下一台Android设备的4939端口映射到PC的4940端口,以此类推。
     
    (2)打开ViewServer服务。
    首先,需要判断ViewServer是否打开:
     1 adb -s emulator-5556 shell service call window 3
     
    如果返回值是"Result: Parcel(00000000 00000000 '........')",说明ViewServer没有打开,那么需要用下面的命令打开ViewServer:
     1 adb -s emulator-5556 shell service call window 1 i32 4939
     
    反之,关闭ViewServer的命令是:
     1 adb -s emulator-5556 shell service call window 2 i32 4939