Skip to content

Commit

Permalink
Fix Android build on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Aug 26, 2024
1 parent 205e0e0 commit 9cabbfd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '11'
java-version: '17'

- name: Disable annotations
run: echo "::remove-matcher owner=csc::"
Expand Down
15 changes: 14 additions & 1 deletion build/BuildFrameworksTasks/BuildAndroidTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,18 @@ public sealed class BuildAndroidTask : FrostingTask<BuildContext>
public override bool ShouldRun(BuildContext context) => context.IsWorkloadInstalled("android");

public override void Run(BuildContext context)
=> context.DotNetPack(context.GetProjectPath(ProjectType.Framework, "Android"), context.DotNetPackSettings);
{
var arguments = new DotNetMSBuildSettings();
arguments.WithProperty("AndroidSdkDirectory", System.Environment.GetEnvironmentVariable ("ANDROID_HOME"));
arguments.WithProperty("AcceptAndroidSDKLicenses", "true");
arguments.WithTarget("InstallAndroidDependencies");
var installSettings = new DotNetBuildSettings
{
MSBuildSettings = arguments,
Verbosity = DotNetVerbosity.Minimal,
Configuration = context.DotNetPackSettings.Configuration,
};
context.DotNetBuild(context.GetProjectPath(ProjectType.Framework, "Android"), installSettings);
context.DotNetPack(context.GetProjectPath(ProjectType.Framework, "Android"), context.DotNetPackSettings);
}
}

0 comments on commit 9cabbfd

Please sign in to comment.