Action required: Update your Android targetSdkVersion by Nov 2, 2020

Dear Friends,

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.

Can you please help on this?

I want to udpate SDK version 29 or higher.

Best Regards!

1 Like
  1. add android platform like this:

ionic cordova platform add android

  1. 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
    }
  1. 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
    }

then build your android.

2 Likes

Thank a lot @erkinalan for sharing this information and its working for me.

2 Likes

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.

Sorry my English, I’m using translation.


do you know about

My solution to my problem of adding the android@9.0.0 platform was:

  • rm -rf node_modules
  • ionic cordova platform rm android
  • update node.js to V11.15.0 npm 6.7.0
  • npm i
  • ionic cordova platform add android@9.0.0

IMPORTANT cord must be in version 9.0.0

Hi, i had change just SDK version and my problem has been solved. so i haven’t add android 9.0.0. Thank you!

[lffruhling]
Thanks exit code 1 fixed

I have the same error as you, but I am installing android 9.0.0 or 10.1.0 . can you help me fix it