Cordova-android v 9.0.0 build failed. Invalid Cordova android platform. API.js missing

1k Views Asked by At

I have been working with [email protected] so far. Everything is in place and working fine. Due to API 29 support, I'm trying to upgrade Cordova-android platform to v9.0.0. But I'm facing a strange error.

Error:

Unable to load PlatformApi from platform. SyntaxError: Unexpected token ... Uncaught, unspecified "error" event. (The platform "android" does not appear to be a valid cordova platform. It is missing API.js. android not supported.)

Could not finish All tasks. See reason below

{ Error: Command failed: cordova platform add [email protected] Uncaught, unspecified "error" event. (The platform "android" does not appear to be a valid cordova platform. It is missing API.js. android not supported.)

at ChildProcess.exithandler (child_process.js:206:12)

at emitTwo (events.js:106:13)

at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
build   at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:498:12)
killed: false,
build
build 
build cmd: 'cordova platform add [email protected]' }
1

There are 1 best solutions below

0
On

I have managed to fix this issue in my Cordova application. What happened to me was that I had an old Node.js version, so I could only use Android 7.0.0 with the command:

cordova platform add [email protected]

Otherwise, I had the same error as yours with the message: "The platform "android" does not appear to be a valid cordova platform. It is missing API.js. android not supported".

However, after upgrading my Node.js to the latest stable version (v14.5.1) with NVM (https://github.com/nvm-sh/nvm) and reinstalling the Android platform with the commands:

cordova platform rm android

cordova platform add [email protected]

My android application now could be built successfully with Cordova and the API 29.