3

I just encountered this problem after creating an app with Cordova. I searched everywhere for this error but can't find anything in all google.

[BUILD SUCCESSFUL

Total time: 2.917 secs
Built the following apk(s):
        C:/MyApp/platforms/android/build/outputs/apk/android-debug.apk
ANDROID_HOME=C:\SDK
JAVA_HOME=C:\Program Files\java\jdk1.8.0_152
No target specified and no devices found, deploying to emulator
Error: Cannot read property 'semver' of null][1]

What it mean? After this doesn't happen anything. Thanks in advance :)

Console output

Greg Whatley
  • 1,020
  • 1
  • 13
  • 32

2 Answers2

4

It looks like you have created your AVD (Android Virtual Device) using API 27 as a system image. Try to delete it and create a new one, using either Oreo or Nougat system image.

As far as I understand it happens due to lack of corresponding mapping here. If you will take a look at node_modules/android-versions/index.js you will see that API 26 is the latest supported one.

Artyom Sokolov
  • 2,385
  • 3
  • 23
  • 34
1

This fixed it for me: Cordova android emulation - Error: Cannot read property 'semver' of null

find the path <project_root>/platforms/android/cordova/lib/emulator.js

find the line avd.target = 'Android ' + level.semver + ' (API level ' +    api_level + ')'; 

replace it with avd.target = 'Android ' + (level ? level.semver : '') + ' (API level ' + api_level + ')';

I'm using an emulated Android Nexus6 with API 24.

Petr
  • 23
  • 1
  • 6