How to build an Ionic3 app for Android 6/7/8?

Hi,
I’d like to build my app for Android 6,7 and 8 (that is API 23).
If I run the command:
>ionic cordova build android --prod --release
The app is built for Android 7 and doesn’t work on Android 6.

cordova platform list
Installed platforms:
  android 7.0.0
Available platforms:
  browser ~5.0.1
  ios ~4.5.4
.....

Which is the best way to make an app that supports Android 6,7 and 8?
Should I build the app three times?

Thank you

cld

The version number (7.0.0) that you see, is the cordova Android version.
This has nothing to do with the actual supported Android version.

Version 7.0.0 of cordova Android has support for Android API 19 (Android 4.4) and up.

So if you build an APK with the settings now, it will work perfectly on Android 4.4 and up.

Thank you for your answer.
However in the config.xml file I can read:
<engine name="android" spec="~7.0.0" />
is it still the cordova Android version or the Android version?

cld

Still the cordova-android version

Cordova Android supported Android versions are here:
https://cordova.apache.org/docs/en/8.x/guide/platforms/android/index.html

So you are totally fine with Cordova-Android 7.x. - you might want to update to 7.1.1 though:
Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: https://ionic.zone/cordova/update

1 Like