cordova - Error: Failed to fetch platform android

后端 未结 15 2403
情深已故
情深已故 2020-11-29 09:19

I installed cordova and create a new project.

But when I use this command to add android platform:

cordova platform add android

15条回答
  •  生来不讨喜
    2020-11-29 10:01

    I had the same issue the way I fixed it was I did the following.

    1. run the command ionic platform add android This should fail and give the error your getting.
    2. It should have added a dependency to app.module.js. Now in here find "cordova-android" check it version at the time of this comment my version was 7.1.4.
    3. Open android studio and go to to project setting and make sure u have the download the same version SDK. For me this was 7.1 Nugget.
    4. create a new emulator with the same version and keep the emulator running.
    5. Go back too your IDE close it and restart the IDE.
    6. Run this command cordova platform rm android && cordova platform add android
    7. DONE! Doing this fixed my issue.

    The reason I found it was not fetching was because cordova was looking for Andriod SDK matching the version 7.1.4 but was not able to find it at the preset location normal "andriod/Sdk".

提交回复
热议问题