Skip to content

Provide warnings and errors around compileSdkVersion(TargetFrameworkVersion), targetSdkVersion, and minSdkVersion #1768

@JonDouglas

Description

@JonDouglas

Google has the following guidance for these three values:

minSdkVersion (lowest possible) <= targetSdkVersion == compileSdkVersion (latest SDK)
  1. We should throw a warning if the targetSdkVersion is lower than compileSdkVersion(TargetFrameworkVersion).

targetSdkVersion < compileSdkVersion(TargetFrameworkVersion)

Sample warning message text:

Your application is running on a version of Android that is more recent than your targetSdkVersion specifies. Set your targetSdkVersion to the highest version of Android available to match your TargetFrameworkVersion.

EX:

Your application is running on a version of Android (26) that is more recent than your targetSdkVersion specifies (24). Set your targetSdkVersion to the highest version of Android available to match your TargetFrameworkVersion (26).

Currently there is a warning in this area, but it doesn't let the developer know exactly what "ACW compilation is" or how they can fix the issue:

warning XA4211: AndroidManifest.xml //uses-sdk/@android:targetSdkVersion '19' is less than $(TargetFrameworkVersion) ''. Using API-26 for ACW compilation.

  1. We should throw an error if the compileSdkVersion(TargetFrameworkVersion) is lower than targetSdkVersion.

compileSdkVersion(TargetFrameworkVersion) < targetSdkVersion

Sample error message text:

The TargetFrameworkVersion should not be lower than targetSdkVersion.

EX:

The TargetFrameworkVersion (26) should not be lower than targetSdkVersion (27)

  1. We should throw an error if the minSdkVersion is greater than targetSdkVersion.

minSdkVersion > targetSdkVersion

Sample error message text:

The minSdkVersion is greater than targetSdkVersion. Please change the value such that minSdkVersion is less than or equal to targetSdkVersion.

EX:

The minSdkVersion (26) is greater than targetSdkVersion. Please change the value such that minSdkVersion is less than or equal to targetSdkVersion (25).

Metadata

Metadata

Assignees

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.enhancementProposed change to current functionality.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions