Cordova android emulation - Error: Cannot read property 'semver' of null

前端 未结 6 880
醉梦人生
醉梦人生 2021-01-30 13:30

Trying to emulate Android app with cordova, but get this error message:

Built the following apk(s): /Users/jnj/cordova/hello/platforms/android/build/outputs/apk/andr

6条回答
  •  野性不改
    2021-01-30 13:43

    The Mighty Chris is right, that is the problem and he fixed it upstream (thank you Chris!). However just to add to his answer, for people like me who cannot update cordova-android to include the patch, the fix is (for cordova-android v6.4.0):

    • find the path /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 + ')';

    Here is the relevant patch.

提交回复
热议问题