Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

cordova - Error: Failed to fetch platform android

I installed cordova and create a new project.

But when I use this command to add android platform:

cordova platform add android

this error appears:

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 create hello com.example.hello HelloWorld

And this is my SDK Manager:

SDK Manager

But I can add ios platform (But I work on Windows)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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 platform add android@5.1.0 which should be a differnet version for you.

Kind regards !


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...