cordova - 错误:无法获取平台 android [英] cordova - Error: Failed to fetch platform android
问题描述
我安装了cordova并创建了一个新项目.
I installed cordova and create a new project.
但是当我使用这个命令添加android平台时:
But when I use this command to add android platform:
cordova 平台添加安卓
cordova platform add android
出现这个错误:
Error: Failed to fetch platform android
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: version not found: cordova-android@5.1.0
这就是我创建新项目的方式:
This is how I created the new project:
cordova 创建 hello com.example.hello HelloWorld
cordova create hello com.example.hello HelloWorld
这是我的 SDK 管理器:
And this is my SDK Manager:
但我可以添加ios平台(但我在Windows上工作)
But I can add ios platform (But I work on Windows)
推荐答案
我在 android@5.1.1 版本中遇到了同样的问题.我解决了这个问题,检查cordova提供的android版本.您可以在 C:/Users/%USER%/.cordova/lib/npm-cache/cordova-android
I had the same problem with the android@5.1.1 version. I solved this issue, checking what version of android is provided by cordova. You can check it in C:/Users/%USER%/.cordova/lib/npm-cache/cordova-android
然后,您安装提供的 android 平台版本.对我来说,它是@5.1.0,它在我的cordova-android 文件夹中.所以我使用了以下 cmd 行:
Then, you install the android platform version provided. For me it was @5.1.0 which was in my cordova-android folder. So I used the cmd line following:
cordova 平台添加 android@5.1.0,这对你来说应该是一个不同的版本.
cordova platform add android@5.1.0 which should be a differnet version for you.
亲切的问候!
这篇关于cordova - 错误:无法获取平台 android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!