1

I am trying to compile an Ionic 2 application on an Android SDK Target 19 (Android 4.4).

Ionic 2 use Cordova.

When I install cordova with NPM, the last version is installed (6.5). When I add an android platform the target is set by Cordova to android-22.

I read in several posts that there is a configuration key in the config.xml which allow to force the Android target.

So I wrote this in my plugin.xml :

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

When I build, the target remain 22 !

I read on other posts that we have to edit some files generated by cordova :

  • /platforms/android/project.properties
  • /platforms/android/AndroidManfiests.xml
  • /platforms/android/CordovaLib/project.properties

In this file, I replaced all the target=android-XX by android-19. I don't like this solution because all this files are generated by Cordova, so I haven't to edit them !

The only solution I found is given in the same post : install an old cordova (cordova version 3.5.0-0.2.7). This version come with Android-19 as default version.

So my question is : Is it possible to use the last cordova with an android target 19 ?

When I read the cordova documentation, I think that answer to this question is "YES". But how to do it ? Why changing targetSdkVersion in plugin.xml haven't any effect on files generated by Cordova ?

Community
  • 1
  • 1
Adrien BARRAL
  • 3,474
  • 1
  • 25
  • 37

0 Answers0