NativeScript / NativeScript/nativescript-cli
Android remote emulator lose connection using ANDROID_ADB_SERVER_ADDRESS
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 1.1k
- 派生
- 204
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 8
描述
Environment
Component nativescript has 7.2.0 version and is up to date.
✔ Component @nativescript/core has 7.2.1 version and is up to date.
✔ Component @nativescript/ios has 7.2.0 version and is up to date.
✔ Component @nativescript/android has 7.0.1 version and is up to date.
Describe the bug
The use of the command for running on a remote Android emulator (in my case a Virtualbox with Ubuntu 20.04.1 and Android SDK and emulator running) as follows:
$ ANDROID_ADB_SERVER_ADDRESS={VirtualMachineIP} ns run android --no-hmr
The application is installed and has run successfully but the CLI command seems to timeout when trying to connect to the application log with the error:
Installing on device emulator-5554...
Successfully installed on device with identifier 'emulator-5554'.
Unable to apply changes on device: emulator-5554. Error is: connect ECONNREFUSED 127.0.0.1:51258.
Seems like NativeScript is trying to connect to a port in the local machine ignoring the ANDROID_ADB_SERVER_ADDRESS IP address
To Reproduce
- Create an Ubuntu virtual machine with android SDK on a VirtualBox or similar on a Mac OS host machine
- create an Android emulator and run it
- in the virtual machine OS (Ubuntu in this case) terminal run
adb -a -P 5037 nodaemon server - in the host machine (Mac OS in my case) execute an android application with the NativeScript CLI
ANDROID_ADB_SERVER_ADDRESS={VirtualMachineIP} ns run android --no-hmr
Expected behavior
Running an Android application in a remote machine as normal as in host machine with debug and log capabilities.
Additional context
The virtual machine should have bridged adapter configured, I don't know if NAT is also working
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用 ANDROID_ADB_SERVER_ADDRESS={VirtualMachineIP} ns run android --no-hmr 以及上文所述的远程 adb 服务器设置重现该问题。跟踪 Android CLI 对安装、日志和调试连接的处理,尤其注意报告的 localhost 端口。当远程模拟器能够在不发生连接超时的情况下运行应用,并具备调试和日志功能时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- android, javascript
- 领域
- cli, mobile-dev, networking
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100