1

I am learning Cordova by going through the docs and many blogs. I am able to create the basic skeleton of the Cordova app using cordova create, and can add the platform using cordova platform add android.

But I want to know how can I add the platform so that the apps I build will require API level 22 and above (i.e. API level not below 22)?

Ayan
  • 2,738
  • 3
  • 35
  • 76

1 Answers1

3

Add the following lines to config.xml:

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

(Cordova Android platform guide)

brodybits
  • 541
  • 4
  • 21
Djiggy
  • 602
  • 6
  • 20
  • I am running cordova-android 6.X.X and I want to support from api level 22 so I should change 14 to 22. Is that correct? – Ayan Jun 22 '17 at 10:47
  • Ok, so to check if it's working or not I have to set up an emulator with android version less than 22 and check whether it's installing or not? Is that right? And what is the use of targetsdkversion? – Ayan Jun 22 '17 at 10:52
  • 1
    Normally yes. Add `targetSdkVersion` with value to 22 too. Read [this](https://stackoverflow.com/questions/4568267/android-min-sdk-version-vs-target-sdk-version#answer-4568358) for a good explaination – Djiggy Jun 22 '17 at 10:59
  • Ok, I gotta try this out. Can you kindly take a look at another [cordova question](https://stackoverflow.com/q/44648751/3697102) – Ayan Jun 22 '17 at 12:27