2
votes

I am working on Ionic framework.

While creating android folder by using following equation,

cordova platform add android

But it gives me following error,

**Using cordova-fetch for [email protected]

(node:11862) UnhandledPromiseRejectionWarning: CordovaError: Failed to fetch platform [email protected] Probably this is either a connection problem, or platform spec is incorrect. Check your connection and platform name/version/URL. Error: npm: Command failed with exit code 1 Error output: npm ERR! code ETARGET npm ERR! notarget No matching version found for [email protected] npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in: npm ERR! /home/jayvyas/.npm/_logs/2018-07-12T11_24_03_356Z-debug.log at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/platform/addHelper.js:312:25 at _rejected (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:797:24) at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:823:30 at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1142:31) at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:808:41) at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:624:44 at runSingle (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:137:13) at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:125:13) at process._tickCallback (internal/process/next_tick.js:61:11) (node:11862) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:11862) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.**

I tried lots of solutions, but no success.

Thank you

3

3 Answers

4
votes

1-remove android platform directory manually or using this command

    ionic cordova platform remove android

2-be sure to download sdk platforms you need via android studio -> Tools -> SDK Manager

3-then try:

ionic cordova platform add android@latest

or a specific version of android:

ionic cordova platform add [email protected]
1
votes

Inside package.json there is a line

"android": "0.0.8",

Just delete this line.

0
votes

first remove platform

ionic cordova platform remove android

after that add platform

ionic cordova platform add android@latest