Error running emulator on android

10,809

Solution 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.

Solution 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.

Share:
10,809
adanalig
Author by

adanalig

Updated on June 05, 2022

Comments

  • adanalig
    adanalig almost 2 years

    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.