Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Emulator not running for Cordova App - adb -s emulator-5584 shell cat /proc/cpuinfo

I'm trying to make my environment work with Cordova and Android emulator with no success. I have installed the Android Studio and I can successfully start the Android Emulator.

I have created a cordova application with the command below:

cordova create myApp

I added support for the Android platform:

cordova plataform add android

I had the following output:

Using cordova-fetch for cordova-android@~6.2.2
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: io.cordova.hellocordova
        Name: HelloCordova
        Activity: MainActivity
        Android target: android-25
Subproject Path: CordovaLib
Android project created with [email protected]
Installing "cordova-plugin-whitelist" for android

   This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

--save flag or autosave detected
Saving android@~6.2.3 into config.xml file ...

Then I try to run the application:

cordova run android

The emulator starts, after a while, that I have the error below in the command prompt:

No target specified and no devices found, deploying to emulator
No emulator specified, defaulting to Nexus_5X_API_24
Waiting for emulator to start...
Error: Failed to execute shell command "getprop,dev.bootcomplete"" on device: 
Error: C:\Users\username\AppData\Local\Android\sdk\platform-tools\adb.exe: Command failed with exit code 3221226356

Does anyone knows how to fix this error?

Some others environment info:

C:\>node -v
v7.4.0

C:\>cordova -v
7.0.1

C:\>java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Edit 1

I have done those steps:

  1. Uninstalled "Android SDK Tools"
  2. Uninstalled "Android Studio"
  3. Deleted files from "C:\Users\USER\AppData\Local\Android\sdk" and "C:\Program Files\Android\Android Studio" files (Because some maybe in use during the uninstallation)
  4. Installed Android Studio
  5. Updated Android Studio

When I execute the command below, I have more information about the error:

cordova run android --verbose

With this output:

Command finished with error code 3221226356: C:\Users\USER\AppData\Local\Android\sdk\platform-tools\adb.exe -s,emulator-5584,shell,cat,/proc/cpuinfo Error: Failed to execute shell command "cat,/proc/cpuinfo"" on device: Error: C:\Users\USER\AppData\Local\Android\sdk\platform-tools\adb.exe:Command failed with exit code 3221226356

When I execute the command below, the adb shows the emulator cpu info, after that, the process stops and the windows ask to break or debug

adb -s emulator-5584 shell cat /proc/cpuinfo
like image 527
mqueirozcorreia Avatar asked Jun 02 '17 18:06

mqueirozcorreia


3 Answers

Downgrade your SDK platform-tools to rev25.0.1.

If you dev in windows, you can download it in https://dl-ssl.google.com/android/repository/platform-tools_r25.0.1-windows.zip

delete or rename your old platform-tools folder, and extract the downloaded file to it.

Works for me!

like image 95
Muhammad Faza Mu'tashim Avatar answered Nov 18 '22 03:11

Muhammad Faza Mu'tashim


I encountered the same issue with an emulator of Nexus5 & Oreo/Nougat.

I changed my emulator to Galaxy Nexus & Lollipop and it worked fine without any modification in the Cordova directories.

It does not seem to be the right solution, but some lower combinations might be available for avoiding this issue.

The command line is:

 $ cordova emulate android

The following is the success log:

No emulator specified, defaulting to Galaxy_Nexus_API_22
Waiting for emulator to start...
emulator: Requested console port 5584: Inferring adb port 5585.
emulator: WARNING: encryption is off
path /home/ximia/.android/avd/Galaxy_Nexus_API_22.avd/system.img.qcow2
Waiting for emulator to boot (this may take a while)...BOOT COMPLETE

like image 4
ximia Avatar answered Nov 18 '22 04:11

ximia


Edit your virtual device (ADV) and go into advanced settings and uncheck Multi-Core CPU.

Work fine to me.

like image 2
Klaid Dias Avatar answered Nov 18 '22 03:11

Klaid Dias