Android ion error emulation - exit code 2

Hey guys, brand new to ionic. I have problems trying to run

ionic emulate android

I get an error message Error: android: Command failed with exit code 2 . But he says BUILD SUCCESSFUL.


What i run

  • Ubuntu 16.04.2
  • Node 6.10.2
  • NPM 3.10.10
  • Ionic 2.2.3
  • Cordova 6.5.0
  • Android Studio 2.3.1

I set the environment variables in my .bashrc:

export ANDROID_HOME=$HOME/Android/Sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Below is the bottom of the output for ionic emulate android

UP-TO-DATE

BUILD SUCCESSFUL

Total time: 1.206 secs

Built the following apk(s): /home/matts-pc/Desktop/turn-app/platforms/android/build/outputs/apk/android-debug.apk

ANDROID_HOME=/home/matts-pc/Android/Sdk

JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

Error: android: Command failed with exit code 2`
enter code here

Here is the result when I run cordova run --list

Available android devices:
Available android virtual devices:
ERROR: Error: android: Command failed with exit code 2
An unexpected error has occured while running list-emulator-images with code 2: Error: /home/matts-pc/Desktop/turn-app/platforms/android/cordova/lib/list-emulator-images: Command failed with exit code 2

Let me know if you need anything else! Thanks you

+4
source share
1 answer

Got a response from this post !

Inside platforms/android/cordova/lib/emulator.js:

Edit:

return superspawn.spawn('android', ['list', 'avds'])

To:

return superspawn.spawn('android', ['list', 'avd'])

Edit:

var command = 'adb -s ' + target + ' install -r "' + apk + '"';

To:

var command = 'adb uninstall "' + pkgName + '"; adb -s ' + target + ' install -r "' + apk + '"';

+4

Source: https://habr.com/ru/post/1675471/


All Articles