简体   繁体   中英

How or Where Cordova platform add android get the minSdkVersion value?

Good day,

I have a cordova mobile project, and I using "cordova platform add android" command to add my android platform.

In my config.xml, I set the minSdkVersion to 26 as follow:

<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
        <application android:allowBackup="false" />
        <application android:networkSecurityConfig="@xml/network_security_config" />
        <uses-sdk android:minSdkVersion="26" />
</edit-config>

When I run "cordova platform add android" command, the "/platforms/android" folder and its files will be removed and auto generated. after it auto generate, I check the cdv-gradle-config.json file under "platforms/android", and found the "MIN_SDK_VERSION": 22.

May I know where is this "22" come from? or any mistaken I did to cause this issue?

My cordova version is 10.0.0 (cordova-lib@10.1.0) . My gradle version is 4.7.

Set this code in config.xml

<preference name="android-minSdkVersion" value="22" /> 
<preference name="android-targetSdkVersion" value="31" />

This is the only tip that works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM