Andrea Calabrò
Andrea Calabrò

Reputation: 59

Cordova, issue after "cordova run android"

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

Upvotes: 3

Views: 3147

Answers (2)

Petr
Petr

Reputation: 33

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.

Upvotes: 1

Artyom Sokolov
Artyom Sokolov

Reputation: 2405

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.

Upvotes: 4

Related Questions