Can cordova [email protected] target SDK 26?

2.7k Views Asked by At

My app is currently running [email protected]. 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
2

There are 2 best solutions below

2
On

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" />
5
On

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.