[TIMOB-25852] Android: Target API Level 26/27 by default
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-05-11T20:32:00.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 7.3.0 |
Components | Android |
Labels | android, android-8, demo_app |
Reporter | Joshua Quick |
Assignee | Gary Mathews |
Created | 2018-03-09T19:13:21.000+0000 |
Updated | 2018-06-25T23:43:54.000+0000 |
Description
*Summary:*
When building for Android, Titanium currently only supports targeting API Levels 23-25 (aka: Android 6.0 - 7.1) if not specified in the "tiapp.xml" file. We should increase the max API Level supported to 27 (aka: Android 8.1) once full functional/regression testing has been performed and any issues discovered have been addressed.
*Changes Required:*
This involves changing the "package.json" file's "android sdk" range...
from:
">=23.x <25.x"
to: ">=23.x <27.x"
.
https://github.com/appcelerator/titanium_mobile/blob/master/android/package.json#L24
We should also consider updating the "android build tools" version range as well.
*Note:*
Titanium developers currently can opt-in to targeting API Level 26+ (aka: Android 8.x) in the "tiapp.xml" themselves as shown below.
<ti:app>
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26"/>
</manifest>
</android>
</ti:app>
In this ticket I've also included an update for the default tiapp.xml by adding the target sdk in the manifest. This is someting most people want/need and adding it to the template might be beneficial by builds not breaking when people install a newer SDK. It also tells people it is possible to select a minimum version and that targeting builds is implemented as functionality.
If you add the manifest part then please add
<manifest android:versionCode="1" android:versionName="1.0.0">
, too! Since you need this for store updates it would be good to have this in the template already[~michael] would you in that case also prefer the iOS version of that included?
iOS works fine by just updating the
This is unrelated to this ticket and should be done in an own one. Ideally by also handing the version tag correctly and auto-bump the versionCode if not manually overriden
[~topener], I don't think we should add a
<uses-sdk/>
to the "tiapp.xml" template. Titanium's build system will automatically add this to the "AndroidManifest.xml" set to the min API Level supported and the highest target API Level supported and installed on the machine. This way it's future proof and won't cause a build failure if we increment the min API Level supported in Titanium. This means less tech-support issues. Developers who add a<uses-sdk/>
are opting-in to managing it themselves and I'm okay with them getting a build failure in the future.[~jquick] yeah good point! I've reverted that part of the commit ;)
[~topener], for your info, we haven't fully tested targeting API Level 26 yet. We still need to identify breaking changes before merging this PR. Our QE team is a bit behind at the moment and hasn't had time yet, but the quick test for the moment is to run though our Kitchen Sink app to see what breaks. For example, I'm pretty sure local notifications will fail to be posted to the status bar when targeting API Level 26 and running on Android 8. This is because our core code does not assign the notification a channel. But when targeting a lower API Level, our app is put into backward compatibility mode and Android 8 will auto-assign it a default channel number. We haven't confirmed this yet, but I'm pretty sure this is true. _(Our "ti.cloudpush" module does not have this issue and already resolves this breaking change.)_ There may be other issues too such as this... https://stackoverflow.com/questions/46980697/lock-screen-orientation-when-targeting-android-api-27-with-a-non-opaque-activity We've got a lot of testing to do, that's for sure. :) The current release version of Titanium allows you to target API Level 26/7 now. So, if you have any interesting apps to test with, please give it a go. Thanks.
PR (master): https://github.com/appcelerator/titanium_mobile/pull/9930 ^ This PR needs to build against the newest API Level to support the newest Google Support libraries. So, we might as well as do this all in one shot in a single PR.
yep makes sense! :)
FR Passed. PR Merged.
Verified the fix in SDK 7.3.0.v20180625114905. Closing.