Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,10 @@ Either change the value in the AndroidManifest.xml to match the $(SupportedOSPla
<comment>The following are literal names and should not be translated: Mono.Android.Export.dll, ExportAttribute, ExportFieldAttribute.</comment>
</data>
<data name="XA4211" xml:space="preserve">
<value>AndroidManifest.xml //uses-sdk/@android:targetSdkVersion '{0}' is less than $(TargetFrameworkVersion) '{1}'. Using API-{2} for ACW compilation.</value>
<comment>The following are literal names and should not be translated: AndroidManifest.xml, //uses-sdk/@android:targetSdkVersion , $(TargetFrameworkVersion), API-{2}, ACW
<value>AndroidManifest.xml //uses-sdk/@android:targetSdkVersion '{0}' is less than $(TargetPlatformVersion) '{1}'. Using API-{2} for ACW compilation.</value>
<comment>The following are literal names and should not be translated: AndroidManifest.xml, //uses-sdk/@android:targetSdkVersion , $(TargetPlatformVersion), API-{2}, ACW
{0} - The target SDK version number
{1} - The target framework version number
{1} - The $(TargetPlatformVersion) number
{2} - The API version number</comment>
</data>
<data name="XA4213" xml:space="preserve">
Expand Down
9 changes: 7 additions & 2 deletions src/Xamarin.Android.Build.Tasks/Tasks/GetJavaPlatformJar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class GetJavaPlatformJar : AndroidTask

public string AndroidSdkDirectory { get; set; }

public string TargetPlatformVersion { get; set; }

[Output]
public string JavaPlatformJarPath { get; set; }

Expand Down Expand Up @@ -118,6 +120,9 @@ string GetTargetSdkVersion (string target, XAttribute target_sdk)
string targetFrameworkVersion = MonoAndroidHelper.SupportedVersions.GetIdFromApiLevel (AndroidSdkPlatform);
string targetSdkVersion = MonoAndroidHelper.SupportedVersions.GetIdFromApiLevel (target);

// For .NET 6+ projects, use TargetPlatformVersion directly
string targetPlatformVersionDisplay = !string.IsNullOrEmpty (TargetPlatformVersion) ? TargetPlatformVersion : "";

if (!int.TryParse (targetFrameworkVersion, out int frameworkSdk)) {
// AndroidSdkPlatform is likely a *preview* API level; use it.
Log.LogWarningForXmlNode (
Expand All @@ -127,7 +132,7 @@ string GetTargetSdkVersion (string target, XAttribute target_sdk)
message: Properties.Resources.XA4211,
messageArgs: new [] {
targetSdkVersion,
MonoAndroidHelper.SupportedVersions.GetIdFromFrameworkVersion (targetFrameworkVersion),
targetPlatformVersionDisplay,
MonoAndroidHelper.SupportedVersions.GetIdFromApiLevel (targetFrameworkVersion),
}
);
Expand All @@ -142,7 +147,7 @@ string GetTargetSdkVersion (string target, XAttribute target_sdk)
message: Properties.Resources.XA4211,
messageArgs: new [] {
targetSdkVersion,
MonoAndroidHelper.SupportedVersions.GetIdFromFrameworkVersion (targetFrameworkVersion),
targetPlatformVersionDisplay,
MonoAndroidHelper.SupportedVersions.GetIdFromApiLevel (targetFrameworkVersion),
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ projects.
BuildingInsideVisualStudio="$(BuildingInsideVisualStudio)"
SupportedOSPlatformVersion="$(SupportedOSPlatformVersion)"
TargetFramework="$(TargetFramework)"
TargetPlatformVersion="$(TargetPlatformVersion)"
>
<Output TaskParameter="JavaPlatformJarPath" PropertyName="JavaPlatformJarPath" />
<Output TaskParameter="TargetSdkVersion" PropertyName="_AndroidTargetSdkVersion" />
Expand Down