Skip to content

Commit

Permalink
Fix android build on v11
Browse files Browse the repository at this point in the history
  • Loading branch information
Difegue committed Aug 2, 2023
1 parent f570d82 commit 1a71f69
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 41 deletions.
1 change: 1 addition & 0 deletions LCDonald.Android/LCDonald.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<ItemGroup>
<PackageReference Include="Avalonia.Android" Version="11.0.2" />
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
</ItemGroup>

Expand Down
24 changes: 22 additions & 2 deletions LCDonald.Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
using Android.App;
using Android.Content.PM;
using Avalonia;
using Avalonia.Android;
using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using LCDonald.Core.Controller;

namespace LCDonald.Android;

[Activity(Label = "LCDonald.Android", Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)]
public class MainActivity : AvaloniaMainActivity
[Activity(
Label = "LCDonald.Android",
Theme = "@style/MyTheme.NoActionBar",
Icon = "@drawable/icon",
MainLauncher = true,
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
public class MainActivity : AvaloniaMainActivity<App>
{

protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
Ioc.Default.ConfigureServices(
new ServiceCollection()
.AddSingleton<IInteropService, AndroidInteropService>()
.BuildServiceProvider());

return base.CustomizeAppBuilder(builder);
}

}
37 changes: 0 additions & 37 deletions LCDonald.Android/SplashActivity.cs

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cd LCDonald.Desktop && dotnet restore && dotnet publish .\LCDonald.Desktop.cspro
# macOS
cd LCDonald.Desktop && dotnet restore && dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-x64 -property:Configuration=Release
# Android (Release is busted for now)
cd LCDonald.Android && dotnet build .\LCDonald.Android.csproj -c debug
# Android
cd LCDonald.Android && dotnet build .\LCDonald.Android.csproj -c release
```

0 comments on commit 1a71f69

Please sign in to comment.