问题描述
我正在与Cordova建立一个项目。在iOS上,工作流程似乎符合我的期望,但是在Android上,这是一种平衡的工作,我不确定如何解决。最初,我在运行 cordova run android ...
时收到以下错误:
I'm building a project with Cordova. On iOS, the workflow seems about what I was expecting but on Android it's quite the balancing act and I'm not entirely sure how to fix. Initially, I receive the following error when running cordova run android ...
:
Error: Failed to execute shell command "getprop,dev.bootcomplete"" on device: Error: adb: Command failed with exit code 1 Error output:
error: device unauthorized.
在这里,我运行 adb-kill服务器
并运行 cordova再次运行android ...
。模拟器和应用程序似乎在启动时没有先前的adb问题,但是,在显示初始屏幕后,应用程序崩溃,并在Android模拟器中显示以下错误对话框:
From here, I run adb-kill server
and run cordova run android ...
again. The emulator and application appear to launch without the previous adb issues, however, after showing the splash screen, the application crashes with the following error dialog in the Android emulator:
Application Error
The connection to the server was unsuccessful.
(file:///android_asset/www/index.html)
如果我运行 cordova再运行一次android ...
应用程序成功加载一次,我可以按预期运行该应用程序。如果我重新启动,则需要重新启动此过程再次。此应用程序可以在其他人的计算机上运行,因此我想我的系统上配置有误,但是我不确定确定错误之处的最佳方法。
If I run cordova run android ...
one more time the application loads successfully and I can run through the application as expected. If I reboot, I need to start this process all over again. This application works on other people's computers so I imagine there is something misconfigured on my system but I'm not sure the best way to proceed determining what is wrong.
推荐答案
对于这种不一致的情况,可能的解决方案如下:
The possible solutions for this inconsistent scenario is as follows:
-
在配置中添加此首选项android平台下的.xml:
Add this preference in you config.xml under android platform:
< preference name = loadUrlTimeoutValue value = 700000 />
在每次启动前杀死并重新启动adb服务器
Kill and restart adb server before every launch
希望对您有所帮助。
更新:添加了偏好代码段
UPDATE: preference snippet added
这篇关于Cordova和ADB服务器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!