Error running emulator on android

浪尽此生 提交于 2019-12-21 05:06:20

问题


I'm trying to run a phonegap app on android and when i run the command

phonegap run android --emulator --verbose

I am getting this error

Running command "getprop emu.uuid" on emulator-5554...

How do i fix this, any ideas? I tried opening it via both command line and android studio emulator hands in both.


回答1:


I have found that if I manually start the AVD before issuing the run command then I do not get this error. Also I found that running an older version of android solves this issue. I do not know exactly how this happens. Running windows 10.




回答2:


I was getting this error on a Android 6.0 API Level 23 Device with cordova on fedora 23 with qemu.

It would run the cordova emulate android and the emulator would show but the app wouldn't install or open in the emulator.

My problem was caused by cordova trying to wait for the device to be ready by polling getprop emu.uuid on the adb shell.

Running getprop emu.uuid in the adb shell didn't yield any results. Looking at the output of getprop shows that an available property is dev.bootcomplete.

I fixed it by changing the following code in platforms/android/cordova/lib/emulator.js (around lines 215-230) to wait for dev.bootcomplete to be 1 instead of polling emu.uuid:

module.exports.wait_for_emulator = function(uuid) {
        ...
        new_started.forEach(function (emulator) {
            promises.push(
                //Adb.shell(emulator, 'getprop emu.uuid') REMOVE THIS
                Adb.shell(emulator, 'getprop dev.bootcomplete')
                .then(function (output) {
                    //if (output.indexOf(uuid) >= 0) { REMOVE THIS
                    if (output == 1) {
                        emulator_id = emulator;
                    }   
                })  
            );  
        });
   ...

This may break when you're running multiple emulators at once.

It looks like the problem is with the emulator. cordova runs emulator -avd <device-name> -prop emu.uuid=cordova_emulator_<date> but emu.uuid isn't properly set in the emulator.

Hope this helps somebody.



来源:https://stackoverflow.com/questions/36390391/error-running-emulator-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!