Nativescript:套接字连接超时

Nativescript: Socket connection timed out

我在 Mac 上,我想 运行 我的应用程序在 USB-C 连接的 Android 设备上。

我的第一步始终是删除 node_modules、hooks 和 platforms 文件夹,以及 package.lock.json 文件。 之后我运行tns build android。 构建完成后,我 运行 tns run android 或通过 nativescript sidekick 启动应用程序。

但现在总是这样结束:

Project successfully built. Installing on device 5B24000362... Successfully installed on device with identifier '5B24000362'. Unable to apply changes on device: 5B24000362. Error is: Socket connection timed out..

由于我在 2 天前就已经遇到此错误并且无法继续使用该应用程序,因此我在 this upgrade instructions 之后更新了所有 nativescript 和 angular 依赖项。 更新后,该应用程序再次运行。 但是现在几个小时后我再次遇到同样的错误(同一个应用程序)。 我什至在它运行后将应用程序推送到 git 存储库,现在重新克隆它,但它不起作用。

确保您使用的是最新的 NativeScript 工具,而不仅仅是依赖项。您可以通过执行 npm i -g nativescript.

安装最新的 CLI

如果应用程序根本没有启动,您可以检查 this answer NativeScript CLI GitHub 存储库中的类似问题。

如果您安装了 nativescript-plugin-firebase。只需更新它:
$ tns plugin update nativescript-plugin-firebase

我 运行 遇到了同样的问题。有趣的是,就我而言,这是因为模拟设备没有足够的存储空间来安装应用程序。一旦我删除了它的一些其他构建,它就起作用了。

我终于通过从 node_modules\nativescript-plugin-firebase\platforms\android\include.gradle 中删除了 admob 来完成这项工作

要删除的行: