无法在模拟器上运行离子应用程序
Posted
技术标签:
【中文标题】无法在模拟器上运行离子应用程序【英文标题】:Unable to run ionic app on emulator 【发布时间】:2018-12-10 13:31:05 【问题描述】:我正在尝试在 android 模拟器上运行 ionic 应用程序,但我不断收到此错误。
ANDROID_HOME=C:\Users\Dell\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_171
(node:14376) UnhandledPromiseRejectionWarning: Error: C:\Users\Dell\AppData\Local\Android\sdk\platform-tools\adb.exe: Command failed with exit code 1 Error output:
adb server version (39) doesn't match this client (40); killing...
could not read ok from ADB Server
* failed to start daemon
error: cannot connect to daemon
at ChildProcess.whenDone (C:\Users\Dell\Desktop\ionicsidemenu\ionic2-sidemenu-highlight\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:180:13)
at maybeClose (internal/child_process.js:936:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:14376) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14376) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
【问题讨论】:
【参考方案1】:这种不一致的场景可能的解决方案如下:
-
在你的android平台下的config.xml中添加这个首选项:
<preference name="loadUrlTimeoutValue" value="700000" />
-
每次启动前杀死并重启 adb 服务器
adb kill-server adb forward --remove-all adb start-server
-
尝试创建一个新的 AVD 并在启动
AVD 删除并重新添加 android 平台并重建相同
【讨论】:
我试图杀死 adb 服务器,但它给了我这个错误 cannot connect to daemon at tcp:5037: cannot connect to 127.0.0.1:5037: No connection could be made because the target machine positively denied它。 (10061)【参考方案2】:运行此命令来解决您的问题:
taskkill /f /im adb.exe
【讨论】:
以上是关于无法在模拟器上运行离子应用程序的主要内容,如果未能解决你的问题,请参考以下文章