2

After upgrading several SDKs and Android Studio to 2.3 this morning, i got the usual slew of failures associated with that. I'm stuck at starting the emulator because some API changed. I get the following:

Running command: android list avds
Command finished with error code 2: android list,avds
Error: android: Command failed with exit code 2
  at ChildProcess.whenDone (/home/mario/src/mobile/regibox/app/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
  at emitTwo (events.js:87:13)
  at ChildProcess.emit (events.js:172:7)
  at maybeClose (internal/child_process.js:854:16)
  at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)

Running the command myself gives me

$ android list avds
*************************************************************************
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.    
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
*************************************************************************    
Invalid or unsupported command "list avds"

Supported commands are:
android list target    
android list avd       
android list device    
android create avd     
android move avd       
android delete avd     
android list sdk       
android update sdk

Here's what i currently have:

$ cordova -v
6.5.0

$ cordova platform ls
Installed platforms:
 android 6.2.0
Available platforms: 
 amazon-fireos ~3.6.3 (deprecated)
 blackberry10 ~3.8.0
 browser ~4.1.0
 firefoxos ~3.6.3
 ubuntu ~4.3.4
 webos ~3.7.0

Now my question is what package must i update and how? Or what package issues

android list avds

This is on linux.

3 Answers3

0

The issue seems to be from the cordova android platform implementation.

You can upgrade to the latest (master) version using:

cordova platform add https://github.com/apache/cordova-android

(copied from https://stackoverflow.com/a/42797817)

Unfortunately, the issue is still present even in the master version (see source code), but will presumably be fixed soon.

As a workaround, you could rename the android utility, anyway it seems to be deprecated as far as I understand:

mv $ANDROID_HOME/tools/android $ANDROID_HOME/tools/android.bak
Community
  • 1
  • 1
ValarDohaeris
  • 6,064
  • 5
  • 31
  • 43
0

Ok, this upgrade also screwed up SD card support on android kitkat. There my solution was to downgrade sdk-tool to 25.2.5. More about this here 4.1 android emulator not detecting sd card

At this point i must say that upgrading android-sdk and android-studio to 2.3 has been a complete disaster that i don't recommend to anyone, unless they have a couple of days of extra time.

Community
  • 1
  • 1
0

It looks like the new version of Android SDK is causing a lot of bugs in cordova build/run system.

As a workaround for now you can edit this file in your project:

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

Find this line (mine is line 119):

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

Change it by:

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

It would work, it works for me.