Apk only installs on nougat devices

I have recently started using ionic/cordova and I am currently in the process of testing my app on different android platforms. In my config.xml file I set my minSdkVersion and targetSdk to 19 (Kitkat) and my maxSdkVersion to 26 (Oreo) like so.

<platform name="android">
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="19" />
<preference name="android-maxSdkVersion" value="26" />

When I add my android platform this carries through into the AndroidManifest.xml like it supposed to. After I run ionic cordova build android --prod --release and continue to sign the app as according to the deploying docs on the ionic site, I try installing the apk on different devices. It installs and works fine on nougat devices but on marshmallow and kitkat devices it doesn’t install at all.

When I run ionic cordova platform add android --save it says:

Using cordova-fetch for cordova-android@~6.3.0
Adding android project…

Creating Cordova project for the Android platform:

Path: platforms\android
Package: io.ionic.starter
Name: Lock_Ninja
Activity: MainActivity
Android target: android-26

Subproject Path: CordovaLib

According to other forums the change made to the config.xml file is suppose to overwrite the Android Target shown above. But despite all this, the apk only installs on nougat devices. How can i fix this?

ionic: version 3.19.0
cordova: 7.1.0
AndroidSdkBuildTools: 27.0.3

Do you get any error messages?
Could it be that you have an older version of the app installed on those devices, or another app with the same package name (io.ionic.starter)? If that’s the case, uninstall those, or change the package name.

I have <preference name="android-minSdkVersion" value="21" /> and didn’t set android-targetSdkVersion or android-maxSdkVersion and haven’t had any issues.

1 Like

Thank you. I uninstalled all other apps there were being tested from my device and it installed fine.How do I change the package name?

In config.xml change <widget id="io.ionic.starter" ...>

You can follow below link: