Can cordova [email protected] target SDK 26?
Asked Answered
H

2

0

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
Heliotype answered 18/8, 2018 at 21:6 Comment(0)
S
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.

Swashbuckler answered 20/8, 2018 at 9:55 Comment(5)
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 [email protected] need a minimum cordova-cli@version? I am running v7.0.1Heliotype
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)Swashbuckler
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.Heliotype
Does anyone happen to know what the minimum cordova base version is needed to support cordova-android 6.4 and 7.1.1 ?Heliotype
Recommended cli 7.1.0 for Cordova-android 6.4.0 and 8.0.0 for Cordova-android 7.1.1Swashbuckler
C
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" />
Costar answered 20/8, 2018 at 6:34 Comment(2)
Is it going to be enough? dont we need to upgrade cordova-android version as well?Machellemachete
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).Costar

© 2022 - 2024 — McMap. All rights reserved.