minSdkVersion and targetSdkVersion

minSdkVersion 19 cannot be smaller than version 22

When you are facing this error during ionic project building, it is as a result that cordova does not set minSdkVersion and targetSdkVersion correctly in app apk.

This was due to a bug in cordova-android@7.x.x but now solved with cordova-android updated versions.

Updating to cordova-android@8.x.x is required when facing this issue and it is pretty simple in doing that.

Lunch terminal inside project folder and run these two commands to upgrade:

//first remove cordova platform android
    cordova platform remove android

//install cordova-android@8.x.x or higher
    cordova platform add android@8.0.0

compile project again and it should work.

Read more about cordova versions from the official website