无法在设备上执行shell命令"getprop,dev.bootcomplete"":Android出错

26 android android-emulator cordova ionic-framework

getprop,dev.bootcomplete在通过Ionic框架构建和部署新的debug-apk文件到Android模拟器后,我收到了错误.

模拟器弹出到Android的主屏幕,但应用程序未安装在模拟器上,因此在启动时不会为模拟器打开.

我在这个问题上看过类似的帖子,尝试了adb中的不同步骤,为模拟器删除和创建新设备,我为API测试的API级别安装了x86和x86_64图像,其中包括API 26.我不知道我还能做些什么.我不相信从cordova中删除android然后再添加它将解决问题.错误日志如下.

编辑:

到目前为止,我在这个问题上看到的每篇文章都没有解决这个问题.我还没有卸载并重新安装Android Studio或任何SDK工具,但我认为我不需要.

可能导致问题的原因是我不得不将我的NDK版本恢复到r16b而不是更新的r17b,因为我的应用程序无法正确使用离子cordova构建.它正在正确构建,但模拟器仍然有这个问题,不会安装我的应用程序.

错误日志:

emulator: Requested console port 5584: Inferring adb port 5585.
HAX is working and emulator runs in fast virt mode.
(node:11468) UnhandledPromiseRejectionWarning: CordovaError: Failed to execute shell command "getprop,dev.bootcomplete"" on device: Error: C:\Users\noaht\AppData\Local\Android\sdk\platform-tools\adb.exe: Command failed with exit code 1 Error output:
error: device still connecting
    at C:\Noah\Noah School\SSAapp\SMAPP\platforms\android\cordova\lib\Adb.js:88:25
    at _rejected (C:\Noah\Noah School\SSAapp\SMAPP\platforms\android\cordova\node_modules\q\q.js:864:24)
    at C:\Noah\Noah School\SSAapp\SMAPP\platforms\android\cordova\node_modules\q\q.js:890:30
    at Promise.when (C:\Noah\Noah School\SSAapp\SMAPP\platforms\android\cordova\node_modules\q\q.js:1142:31)
    at Promise.promise.promiseDispatch (C:\Noah\Noah School\SSAapp\SMAPP\platforms\android\cordova\node_modules\q\q.js:808:41)
    at C:\Noah\Noah School\SSAapp\SMAPP\platforms\android\cordova\node_modules\q\q.js:624:44
    at runSingle (C:\Noah\Noah School\SSAapp\SMAPP\platforms\android\cordova\node_modules\q\q.js:137:13)
    at flush (C:\Noah\Noah School\SSAapp\SMAPP\platforms\android\cordova\node_modules\q\q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
(node:11468) 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:11468) [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.
emulator: S
aving state on exit with session uptime 4695 ms
Run Code Online (Sandbox Code Playgroud)

jce*_*ile 44

这是一个cordova-android 错误,因为谷歌在尝试运行应用程序时可能会更改错误消息.

它已经修复并在cordova-android 7.1.1或更新版本中发布.如果您无法更新到这些版本:

我认为如果您自己应用更改,它将起作用yourAppName/platforms/android/cordova/lib/emulator.js

更改

if ((error && error.message && (error.message.indexOf('not found') > -1)) || (error.message.indexOf('device offline') > -1))

if ((error && error.message && (error.message.indexOf('not found') > -1)) || (error.message.indexOf('device offline') > -1) || (error.message.indexOf('device still connecting') > -1))


Pra*_*nit 19

另一种解决方法是从Android studio启动模拟器,然后运行cordova命令来运行app.这种方式cordova发现模拟器已经运行,它避免了竞争条件.谢谢!


nik*_*vic 7

这是Ionic 3版本的解决方案:

  1. 打开Android Studio,转到AVD Manager
  2. 创建一个新的AVD设备,单击“显示高级设置”
  3. 选择“冷启动”。默认情况下,选择“快速启动”。

尝试再次运行模拟器。