Skip to content

SupportedOSPlatformVersion and minSdkVersion interactions #8040

@pjcollins

Description

@pjcollins

We have an issue where we will sometimes generate an AndroidManifest.xml file with a minSdkVersion element of 19, a version lower than our supported minimum of 21. I started on a fix in #8026 but wanted to discuss the user experience around this further.

I would propose the following:

  1. If the user does not set minSdkVersion explicitly in their manifest, we should always set minSdkVersion to SupportedOSPlatformVersion, regardless of whether the manifest has a targetSdkVersion set or not. We shouldn't flip this value arbitrarily to 19 (or 21) if targetSdkVersion is set.
  2. We should introduce build errors for cases where the user sets SupportedOSPlatformVersion < 21 or minSdkVersion < 21. The .NET SDK may have one we can hook into for the former, but we will probably need to write our own for the latter.
  3. If the user sets a minSdkVersion explicitly in their manifest and it does not match SupportedOSPlatformVersion, we should prefer SupportedOSPlatformVersion and warn the user.

The # 3 proposal above is potentially the larger behavior change to consider. Folks may be more accustomed to setting minSdkVersion in their manifests, as I don’t believe we’ve had a corresponding MSBuild property for this in the past. However, I think we want to be moving in a direction where we steer folks away from these kind of platform specific settings. In that regard preferring SupportedOSPlatformVersion over minSdkVersion feels like the better behavior.

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions