Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error running emulator on android

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.

like image 992
adanalig Avatar asked Apr 03 '16 19:04

adanalig


People also ask

How do I fix an error opening emulator?

If the emulator fails to launch due to the error vulkan-1. dll cannot be found , you probably need to update the emulator. To update the emulator in Android Studio, go to Tools > SDK Manager and install the latest stable version of Android platform.

How do I get my Android emulator to work?

Run your app on the emulatorIn the toolbar, select the AVD that you want to run your app on from the target device drop-down menu. Click Run. The emulator might take a minute or so to launch for the first time, but subsequent launches will use a snapshot and should launch faster.


2 Answers

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.

like image 66
John Heeter Avatar answered Sep 22 '22 11:09

John Heeter


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.

like image 38
Raufio Avatar answered Sep 20 '22 11:09

Raufio