0

My app is currently running cordova-android@6.2.3. I am getting notices from Google that my app is currently targeting SDK 25 and that I need to target SDK 26.

From Google:

From August 2018, new apps must target at least Android 8.0 (API level 26).
From November 2018, app updates must target Android 8.0 (API level 26).

I have a few months for app updates to continue to work but I am going to run into a wall here shortly. Can I simply just add targetSdkVersion 26 and expect my app to work?

<preference name="android-targetSdkVersion" value="26">

Or does SDK 26 need a minimum cordova-android base like @6.3.x or @7.0.1 or ??? Via Android Studio SDK Manager i have installed SDKs 26, 27 and parts of 28. And I currently have minSdkVersion set to 19.

I am just so fearful of forcing updates - so many plugins fail after major cordova-android@ updates/upgrades. I am trying to avoid doing any of that with my current prod version of my app until I can properly port my app to all the latest and greatest plugins (a very painful and often lengthy process). I am in the process of building that whole new environment, but while I am I still need to make changes to my prod app while that mega-conversion is taking place.

My environment:

Your system information:

Cordova CLI: 7.0.1
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Version: 1.3.4
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Windows 7 SP1
Node Version: v6.10.3
rolinger
  • 2,787
  • 1
  • 31
  • 53

2 Answers2

2

You can force it, but when you change the target SDK version, the code doesn't work the same way it used to, so your app might break. Also a few plugins will need to be updated to properly work with SDK 26.

When a new Cordova version is released it doesn't just bump the SDK version, it also changes the required code to make sure it continues working.

So give it a try and see if everything works, and if it doesn't start by updating what doesn't work.

jcesarmobile
  • 51,328
  • 11
  • 132
  • 176
  • It seems you are correct. I copied to a new project directory and began the updates and everything is broken now. I am going to have to step through the install plugin by plugin to see what is broken now. Does android@6.3 need a minimum cordova-cli@version? I am running v7.0.1 – rolinger Aug 20 '18 at 11:50
  • Supposedly new platforms are still compatible with older cli version, but it's not guaranteed. BTW, latest 6.x.x of cordova-android s 6.4.0, not 6.3.0. Also, first officially compatible with SDK 26 is 7.0.0, but if you are going to 7.x.x is better if you go to latest (7.1.1) – jcesarmobile Aug 20 '18 at 12:06
  • Thanks again. I have spent all day today re-installing all the various components of my app and have run into more than a few headaches - but I might just go straight to 7.1.1 now. Going to test a few more things and make a decision. – rolinger Aug 20 '18 at 20:46
  • Does anyone happen to know what the minimum cordova base version is needed to support cordova-android 6.4 and 7.1.1 ? – rolinger Aug 20 '18 at 20:55
  • Recommended cli 7.1.0 for Cordova-android 6.4.0 and 8.0.0 for Cordova-android 7.1.1 – jcesarmobile Aug 20 '18 at 22:14
1

Changing targetSdkVersion preference should work. You will require corresponding SDK Build tools though.(26.x.x for SDK 26). Also you might wanna close the XML.

 <preference name="android-targetSdkVersion" value="26" />
  • Is it going to be enough? dont we need to upgrade cordova-android version as well? – Ahmad Ayyaz Jul 04 '19 at 07:56
  • That depends on your plugin stack. If you have an old project and you have older set of plugins , and the API might not be breaking use the targetSdkVersion. Some updates like Lollipop --> Marshmallow had breaking changes which includes the newer permission model. In such situation you have to update the cordova-android and your plugin stack. This gets trickier if you have a plugin which doesn't play well on newer cordova-android versions(like geofence). – Karan Gandhi Jul 05 '19 at 08:49