I am trying to update target SDK version 29 using cordova android platform 9.0.0
ionic cordova platform add android@9.0.0
But it’s getting me error like,
> cordova.cmd platform add android@9.0.0
Using cordova-fetch for cordova-android@9.0.0
Adding android project...
Unable to load PlatformApi from platform. SyntaxError: Unexpected token {
Unhandled "error" event. (The platform "android" does not appear to be a valid cordova platform. It
is missing API.js. android not supported.)
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd platform add android@9.0.0 exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
after downloaded android platform go to: Platforms → android → build.gradle then go to the bottom of the build.gradle page, and you will find something like this:
project.ext {
defaultBuildToolsVersion="28.0.3" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
}
change the code:
project.ext {
defaultBuildToolsVersion="29" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=29 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=29 //Integer - We ALWAYS compile with the latest by default
}
Hello @Dhb after the above changes, did you manage to add the 9.0.0 platform? I’m trying to add a cordova camera plugin and I get the following error: Plugin doesn’t support this project’s cordova-android version. cordova-android: 8.1.0, failed version requirement:> = 9.0.0.
When I try to add android@9.0.0 I get the same initial problem as yours.