Support setting target_sdk_version separately from sdk_version

Before this change, if targetSdkVersion wasn't set in the
AndroidManifest.xml, we'd set it to the sdk_version from the Android.bp.

But there are cases where you want to compile against a later SDK, but
target an earlier one (especially if you depend on libraries that need
to be compiled against more recent SDKs, like androidx).

Test: build APK with different target_sdk_version.
Change-Id: Iaed36b522955a374a049ef331158cc8fc5798ad2
This commit is contained in:
Dan Willemsen
2018-10-31 15:28:47 -07:00
parent b259ede324
commit 419290aba9
4 changed files with 22 additions and 1 deletions

View File

@@ -58,7 +58,7 @@ func manifestMerger(ctx android.ModuleContext, manifest android.Path, sdkContext
Output: fixedManifest,
Args: map[string]string{
"minSdkVersion": sdkVersionOrDefault(ctx, sdkContext.minSdkVersion()),
"targetSdkVersion": sdkVersionOrDefault(ctx, sdkContext.sdkVersion()),
"targetSdkVersion": sdkVersionOrDefault(ctx, sdkContext.targetSdkVersion()),
"args": strings.Join(args, " "),
},
})