0

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 ([email protected]). My gradle version is 4.7.

1
  • 1
    Set this code in config.xml <preference name="android-minSdkVersion" value="22" /> <preference name="android-targetSdkVersion" value="31" /> Commented Nov 1, 2021 at 9:33

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.