本文介绍了在启动自动转发端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要转发上的Andr​​oid模拟器的端口,现在我不得不每次都输入命令:

I need to forward a port on an android emulator, right now I had to type the command every time:

ADB转发TCP:23946 TCP:23946

有没有什么办法让这种自动?我试图用一个脚本来代替ADB但命令将无法正常工作,直到设备正常运行。

Is there any way to make this automatic? I tried to replace adb with a script but that command won't work until the device is up and running.

任何想法?

推荐答案

根据的(我已经测试和工程,但它不是为这样一个方案),你可以简单地写等待,直到模拟器引导脚本。

Based on this answer (which I've tested and works, though it wasn't for a scenario like this one), you could simply write a script that waits until the emulator is booted.

喜欢的东西(伪code,不知道你是在哪个平台上):)

Something like (pseudocode, don't know which platform you're on) :)

emulator @emulator-name
while ('adb shell getprop init.svc.bootanim' == "running") sleep(10s)
adb forward tcp:23946 tcp:23946

这篇关于在启动自动转发端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-29 19:31