更新时间:2021-10-13 22:40:44
我也用我的ionic-cli v3.9.2遇到了这个问题,我发现问题是由位于 $ {YOUR_PROJECT_DIR} / platforms / android / cordova / lib / check_reqs中的文件报告的。 JS
。此文件中的 check_android_target
方法使用 android list targets --compact
命令检查是否已正确安装android env。但是这个检查的正确命令是 android list target --compact
(注意目标
不是目标
)。也许这是旧版cordova中的拼写错误。
I also met this problem with my ionic-cli v3.9.2, and I found that the problem is reported by a file which is located in ${YOUR_PROJECT_DIR}/platforms/android/cordova/lib/check_reqs.js
. The check_android_target
method in this file use android list targets --compact
command to check if you have installed android env correctly. But the correct command for this check is android list target --compact
(notice target
not targets
) . Maybe it's a typo in old version cordova.
Ionic未集成最新版本的cordova。所以我的解决方案是手动修复这个错字并且它可以工作。
Ionic doesn't integrate the latest release of cordova. So my solution is fix this typo manually and it works.
更新:
当您解决第一个问题时,也许您会遇到另一个问题,即离子 - cli会告诉你,你没有安装模拟器,但你确实有一个。这是 $ {YOUR_PROJECT_DIR} platforms / android / cordova / lib / emulator.js
中的另一个错字。只需将安卓列表avds
更改为安卓列表avd
即可使其正常工作。
UPDATE:
When you fix the first problem,maybe you will meet another problem that the ionic-cli will tell you that you don't have a emulator installed but you actually have one. It's another typo in ${YOUR_PROJECT_DIR}platforms/android/cordova/lib/emulator.js
. just change android list avds
to android list avd
will make it work.
然后我发现还有一个问题导致模拟器无法启动。可能是这个会对你有帮助。
And then I found there's one more problems which causes the emulator can not be launched. May be this will help you.