minSdkVersion ignored during build

Hi,
I’m building my app with tag
<preference name="android-minSdkVersion" value="19" />,
However, the generated apk has
sdkVersion:'15'

I’ve looked at my AndroidManifest.xml and I can find
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="25" />
I’ve also tried to build forcing minsdk version from command, like
ionic cordova build android --prod --release -- --minSdkVersion=19
but nothing change, the sdkversion is always 15.

It’s a bug? Any ideas?
Thank you all
Lorenzo

Here’s the output of my ionic info and ionic cordova requirements:

$ ionic info
cli packages: (/mnt/c/Users/loren/XXX/node_modules)
    @ionic/cli-utils  : 1.10.2
    ionic (Ionic CLI) : 3.10.3
global packages:
    Cordova CLI : 7.0.1
local packages:
    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.6.1
System:
    Android SDK Tools : 26.1.1
    Node              : v6.11.2
    npm               : 4.2.0
    OS                : Linux 4.4

$ ionic cordova requirements
> cordova requirements
Requirements check results for android:

Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-26,android-25

Gradle: installed /usr/share/gradle/bin/gradle

I’ve updated my app to ionic 3.7.1 with ionic/app-scripts 3.0.0 but seem that minSdkVersion is still ignored.
Is <preference name="android-minSdkVersion" value="XX" /> an obsolete preference?
How can I set this limit? I cannot find any documentation about it.

Thanks
Lorenzo

Same issue. Any fix?

Hi douglasfumec,
I’ve fixed with

cordova run android -- --gradleArg=-PcdvMinSdkVersion=19

Or you can try one of these methods listed here
https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#setting-gradle-properties

Hope this help.

Lorenzo

I’ve fixed it by changing the minSdkVersion Gradle variable of the plugin cordova-plugin-browsertab, because it overwritten my project Gradle variable.

def minSdkVersion = 16 to def minSdkVersion = 22 of the file BrowserTab.gradle

Thank you very much!

1 Like

@douglasfumec Thank you very much! It worked, the plugin should not override this configuration still.