Can't install android platform

hello
I can’t instalI android platform on my project, since instalI android studio
I’ ve try to upgrade-downgrade java sdk, android sdk, nothings works.

I am now with:
android sdk 25
java sdk 1.8

My ionic info:

cli packages: (C:\Users\fred\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 6.5.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android broken
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v8.9.4
    npm               : 4.6.1
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : C:\Users\fred\AppData\Local\Android\Sdk

Misc:

    backend : pro

when I try to install android platform i have always the same issue.

Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: io.ionic.ternatsterker
        Name: ternatsterker
        Activity: MainActivity
        Android target: android-26
Subproject Path: CordovaLib
Android project created with cordova-android@6.4.0
Installing "cordova-plugin-camera" for android
Failed to install 'cordova-plugin-camera':Error: cmd: Command failed with exit code ENOENT
    at ChildProcess.whenDone (C:\Users\fred\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
    at emitOne (events.js:116:13)
    at ChildProcess.emit (events.js:211:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:196:12)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
Error: cmd: Command failed with exit code ENOENT

my project work properly on local or via ionic view, but can’t add a platform.
help me please.

see

Have you solve this problem. I also have same problem with you. ‘ionic serve’ works but when I try ‘ionic cordova run android’ trigger this error to me. Thank you.

First of all you have to update your npm.

npm install npm@latest -g

The current version should be 5.6.0

Your global packages are also outdated.

npm update -g

The current version should be 8.0.0

Now lets fix the camera issue:

Check out your plugins folder. If the cordova-plugin-camera is present remove it.

Also remove the platforms folder in your application folder. Same as the node_modules folder.


After that do npm-install.

Lets install camera again:

$ ionic cordova plugin add cordova-plugin-camera
$ npm install --save @ionic-native/camera

Now try:
ionic cordova run android

It should work now. (I hope :sweat_smile:)