diff --git a/NuGet.config b/NuGet.config
index 1a0f14021c0..4a68a68f8d4 100644
--- a/NuGet.config
+++ b/NuGet.config
@@ -21,6 +21,7 @@
+
diff --git a/samples/NativeAOT/App.xaml b/samples/NativeAOT/App.xaml
new file mode 100644
index 00000000000..05dc94e9e83
--- /dev/null
+++ b/samples/NativeAOT/App.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/NativeAOT/App.xaml.cs b/samples/NativeAOT/App.xaml.cs
new file mode 100644
index 00000000000..79a77569f63
--- /dev/null
+++ b/samples/NativeAOT/App.xaml.cs
@@ -0,0 +1,14 @@
+namespace NativeAOT;
+
+public partial class App : Application
+{
+ public App()
+ {
+ InitializeComponent();
+ }
+
+ protected override Window CreateWindow(IActivationState? activationState)
+ {
+ return new Window(new AppShell());
+ }
+}
\ No newline at end of file
diff --git a/samples/NativeAOT/AppShell.xaml b/samples/NativeAOT/AppShell.xaml
new file mode 100644
index 00000000000..f1086a916c0
--- /dev/null
+++ b/samples/NativeAOT/AppShell.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
diff --git a/samples/NativeAOT/AppShell.xaml.cs b/samples/NativeAOT/AppShell.xaml.cs
new file mode 100644
index 00000000000..f393f3d5a07
--- /dev/null
+++ b/samples/NativeAOT/AppShell.xaml.cs
@@ -0,0 +1,9 @@
+namespace NativeAOT;
+
+public partial class AppShell : Shell
+{
+ public AppShell()
+ {
+ InitializeComponent();
+ }
+}
diff --git a/samples/NativeAOT/MainActivity.cs b/samples/NativeAOT/MainActivity.cs
deleted file mode 100644
index aaedc0aef2d..00000000000
--- a/samples/NativeAOT/MainActivity.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using Android.Runtime;
-using Android.Util;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-namespace NativeAOT;
-
-// Name required for typemap in NativeAotTypeManager
-[Activity (Label = "@string/app_name", MainLauncher = true, Name = "my.MainActivity")]
-public class MainActivity : Activity
-{
- protected override void OnCreate(Bundle? savedInstanceState)
- {
- Log.Debug ("NativeAOT", "MainActivity.OnCreate()");
-
- base.OnCreate(savedInstanceState);
-
- // Set our view from the "main" layout resource
- SetContentView(Resource.Layout.activity_main);
- }
-}
\ No newline at end of file
diff --git a/samples/NativeAOT/MainApplication.cs b/samples/NativeAOT/MainApplication.cs
deleted file mode 100644
index e3f2c6f546f..00000000000
--- a/samples/NativeAOT/MainApplication.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Android.Runtime;
-using Android.Util;
-
-///
-/// NOTE: This class is not required, but used for testing Android.App.Application subclasses.
-/// Name required for typemap in NativeAotTypeManager
-///
-[Application (Name = "my.MainApplication")]
-public class MainApplication : Application
-{
- public MainApplication (IntPtr handle, JniHandleOwnership transfer)
- : base (handle, transfer)
- {
- Log.Debug ("NativeAOT", $"Application..ctor({handle.ToString ("x2")}, {transfer})");
- }
-
- public override void OnCreate ()
- {
- Log.Debug ("NativeAOT", "Application.OnCreate()");
-
- base.OnCreate ();
- }
-}
diff --git a/samples/NativeAOT/MainPage.xaml b/samples/NativeAOT/MainPage.xaml
new file mode 100644
index 00000000000..a32254090aa
--- /dev/null
+++ b/samples/NativeAOT/MainPage.xaml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/NativeAOT/MainPage.xaml.cs b/samples/NativeAOT/MainPage.xaml.cs
new file mode 100644
index 00000000000..375e1714470
--- /dev/null
+++ b/samples/NativeAOT/MainPage.xaml.cs
@@ -0,0 +1,23 @@
+namespace NativeAOT;
+
+public partial class MainPage : ContentPage
+{
+ int count = 0;
+
+ public MainPage()
+ {
+ InitializeComponent();
+ }
+
+ private void OnCounterClicked(object? sender, EventArgs e)
+ {
+ count++;
+
+ if (count == 1)
+ CounterBtn.Text = $"Clicked {count} time";
+ else
+ CounterBtn.Text = $"Clicked {count} times";
+
+ SemanticScreenReader.Announce(CounterBtn.Text);
+ }
+}
diff --git a/samples/NativeAOT/MauiProgram.cs b/samples/NativeAOT/MauiProgram.cs
new file mode 100644
index 00000000000..a126458969e
--- /dev/null
+++ b/samples/NativeAOT/MauiProgram.cs
@@ -0,0 +1,24 @@
+using Microsoft.Extensions.Logging;
+
+namespace NativeAOT;
+
+public static class MauiProgram
+{
+ public static MauiApp CreateMauiApp()
+ {
+ var builder = MauiApp.CreateBuilder();
+ builder
+ .UseMauiApp()
+ .ConfigureFonts(fonts =>
+ {
+ fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
+ fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
+ });
+
+#if DEBUG
+ builder.Logging.AddDebug();
+#endif
+
+ return builder.Build();
+ }
+}
diff --git a/samples/NativeAOT/NativeAOT.csproj b/samples/NativeAOT/NativeAOT.csproj
index 18922a65b67..9b4042c7814 100644
--- a/samples/NativeAOT/NativeAOT.csproj
+++ b/samples/NativeAOT/NativeAOT.csproj
@@ -1,10 +1,13 @@
$(DotNetAndroidTargetFramework)
- 21
+ 23
Exe
enable
+ true
+ true
enable
+ NativeAOT
net.dot.hellonativeaot
1
1.0
@@ -14,6 +17,14 @@
true
true
+
+ true
+ true
+
+ 10.0.0-ci.net10.25074.1
+
+ $(MSBuildThisFileDirectory)..\..\packages
+ D:\src\android-libraries\output
@@ -21,8 +32,21 @@
android-x64
<_NuGetFolderOnCI>..\..\bin\Build$(Configuration)\nuget-unsigned
- $(_NuGetFolderOnCI)
+ $(RestoreAdditionalProjectSources);$(_NuGetFolderOnCI)
<_FastDeploymentDiagnosticLogging>true
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/NativeAOT/AndroidManifest.xml b/samples/NativeAOT/Platforms/Android/AndroidManifest.xml
similarity index 63%
rename from samples/NativeAOT/AndroidManifest.xml
rename to samples/NativeAOT/Platforms/Android/AndroidManifest.xml
index 3fead98ca0f..e95a582b9f3 100644
--- a/samples/NativeAOT/AndroidManifest.xml
+++ b/samples/NativeAOT/Platforms/Android/AndroidManifest.xml
@@ -1,6 +1,7 @@
-
+
+
\ No newline at end of file
diff --git a/samples/NativeAOT/Platforms/Android/MainActivity.cs b/samples/NativeAOT/Platforms/Android/MainActivity.cs
new file mode 100644
index 00000000000..74711947fda
--- /dev/null
+++ b/samples/NativeAOT/Platforms/Android/MainActivity.cs
@@ -0,0 +1,19 @@
+using Android.App;
+using Android.Content.PM;
+using Android.OS;
+using Android.Runtime;
+using Android.Util;
+
+namespace NativeAOT;
+
+// Name required for typemap in NativeAotTypeManager
+[Activity (Name = "my.MainActivity", Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
+public class MainActivity : MauiAppCompatActivity
+{
+ protected override void OnCreate (Bundle? savedInstanceState)
+ {
+ Log.Debug ("NativeAOT", "MainActivity.OnCreate()");
+
+ base.OnCreate (savedInstanceState);
+ }
+}
diff --git a/samples/NativeAOT/Platforms/Android/MainApplication.cs b/samples/NativeAOT/Platforms/Android/MainApplication.cs
new file mode 100644
index 00000000000..bcbb7fdedbf
--- /dev/null
+++ b/samples/NativeAOT/Platforms/Android/MainApplication.cs
@@ -0,0 +1,28 @@
+using Android.App;
+using Android.Runtime;
+using Android.Util;
+
+namespace NativeAOT;
+
+///
+/// NOTE: This class is not required, but used for testing Android.App.Application subclasses.
+/// Name required for typemap in NativeAotTypeManager
+///
+[Application (Name = "my.MainApplication")]
+public class MainApplication : MauiApplication
+{
+ public MainApplication (IntPtr handle, JniHandleOwnership transfer)
+ : base (handle, transfer)
+ {
+ Log.Debug ("NativeAOT", $"Application..ctor({handle.ToString ("x2")}, {transfer})");
+ }
+
+ public override void OnCreate ()
+ {
+ Log.Debug ("NativeAOT", "Application.OnCreate()");
+
+ base.OnCreate ();
+ }
+
+ protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
+}
diff --git a/samples/NativeAOT/Platforms/Android/Resources/values/colors.xml b/samples/NativeAOT/Platforms/Android/Resources/values/colors.xml
new file mode 100644
index 00000000000..c04d7492abf
--- /dev/null
+++ b/samples/NativeAOT/Platforms/Android/Resources/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #512BD4
+ #2B0B98
+ #2B0B98
+
\ No newline at end of file
diff --git a/samples/NativeAOT/Resources/AppIcon/appicon.svg b/samples/NativeAOT/Resources/AppIcon/appicon.svg
new file mode 100644
index 00000000000..9d63b6513a1
--- /dev/null
+++ b/samples/NativeAOT/Resources/AppIcon/appicon.svg
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/samples/NativeAOT/Resources/AppIcon/appiconfg.svg b/samples/NativeAOT/Resources/AppIcon/appiconfg.svg
new file mode 100644
index 00000000000..21dfb25f187
--- /dev/null
+++ b/samples/NativeAOT/Resources/AppIcon/appiconfg.svg
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/samples/NativeAOT/Resources/Fonts/OpenSans-Regular.ttf b/samples/NativeAOT/Resources/Fonts/OpenSans-Regular.ttf
new file mode 100644
index 00000000000..29bfd35a2bf
Binary files /dev/null and b/samples/NativeAOT/Resources/Fonts/OpenSans-Regular.ttf differ
diff --git a/samples/NativeAOT/Resources/Fonts/OpenSans-Semibold.ttf b/samples/NativeAOT/Resources/Fonts/OpenSans-Semibold.ttf
new file mode 100644
index 00000000000..54e7059cf36
Binary files /dev/null and b/samples/NativeAOT/Resources/Fonts/OpenSans-Semibold.ttf differ
diff --git a/samples/NativeAOT/Resources/Images/dotnet_bot.png b/samples/NativeAOT/Resources/Images/dotnet_bot.png
new file mode 100644
index 00000000000..1d1b981ee1a
Binary files /dev/null and b/samples/NativeAOT/Resources/Images/dotnet_bot.png differ
diff --git a/samples/NativeAOT/Resources/Raw/AboutAssets.txt b/samples/NativeAOT/Resources/Raw/AboutAssets.txt
new file mode 100644
index 00000000000..89dc758d6e0
--- /dev/null
+++ b/samples/NativeAOT/Resources/Raw/AboutAssets.txt
@@ -0,0 +1,15 @@
+Any raw assets you want to be deployed with your application can be placed in
+this directory (and child directories). Deployment of the asset to your application
+is automatically handled by the following `MauiAsset` Build Action within your `.csproj`.
+
+
+
+These files will be deployed with your package and will be accessible using Essentials:
+
+ async Task LoadMauiAsset()
+ {
+ using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
+ using var reader = new StreamReader(stream);
+
+ var contents = reader.ReadToEnd();
+ }
diff --git a/samples/NativeAOT/Resources/Splash/splash.svg b/samples/NativeAOT/Resources/Splash/splash.svg
new file mode 100644
index 00000000000..21dfb25f187
--- /dev/null
+++ b/samples/NativeAOT/Resources/Splash/splash.svg
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/samples/NativeAOT/Resources/Styles/Colors.xaml b/samples/NativeAOT/Resources/Styles/Colors.xaml
new file mode 100644
index 00000000000..30307a5ddc3
--- /dev/null
+++ b/samples/NativeAOT/Resources/Styles/Colors.xaml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+ #512BD4
+ #ac99ea
+ #242424
+ #DFD8F7
+ #9880e5
+ #2B0B98
+
+ White
+ Black
+ #D600AA
+ #190649
+ #1f1f1f
+
+ #E1E1E1
+ #C8C8C8
+ #ACACAC
+ #919191
+ #6E6E6E
+ #404040
+ #212121
+ #141414
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/NativeAOT/Resources/Styles/Styles.xaml b/samples/NativeAOT/Resources/Styles/Styles.xaml
new file mode 100644
index 00000000000..86f574d8c77
--- /dev/null
+++ b/samples/NativeAOT/Resources/Styles/Styles.xaml
@@ -0,0 +1,451 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/NativeAOT/Resources/layout/activity_main.xml b/samples/NativeAOT/Resources/layout/activity_main.xml
deleted file mode 100644
index f94985291bf..00000000000
--- a/samples/NativeAOT/Resources/layout/activity_main.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/samples/NativeAOT/Resources/mipmap-anydpi-v26/appicon.xml b/samples/NativeAOT/Resources/mipmap-anydpi-v26/appicon.xml
deleted file mode 100644
index 7751f69514d..00000000000
--- a/samples/NativeAOT/Resources/mipmap-anydpi-v26/appicon.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/samples/NativeAOT/Resources/mipmap-anydpi-v26/appicon_round.xml b/samples/NativeAOT/Resources/mipmap-anydpi-v26/appicon_round.xml
deleted file mode 100644
index 7751f69514d..00000000000
--- a/samples/NativeAOT/Resources/mipmap-anydpi-v26/appicon_round.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/samples/NativeAOT/Resources/mipmap-hdpi/appicon.png b/samples/NativeAOT/Resources/mipmap-hdpi/appicon.png
deleted file mode 100644
index 0abfc1b581c..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-hdpi/appicon.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-hdpi/appicon_background.png b/samples/NativeAOT/Resources/mipmap-hdpi/appicon_background.png
deleted file mode 100644
index 513e69d8412..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-hdpi/appicon_background.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-hdpi/appicon_foreground.png b/samples/NativeAOT/Resources/mipmap-hdpi/appicon_foreground.png
deleted file mode 100644
index 99d3a291bc3..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-hdpi/appicon_foreground.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-mdpi/appicon.png b/samples/NativeAOT/Resources/mipmap-mdpi/appicon.png
deleted file mode 100644
index 7b5a2e2bf8d..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-mdpi/appicon.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-mdpi/appicon_background.png b/samples/NativeAOT/Resources/mipmap-mdpi/appicon_background.png
deleted file mode 100644
index 9e2d1e4d8d4..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-mdpi/appicon_background.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-mdpi/appicon_foreground.png b/samples/NativeAOT/Resources/mipmap-mdpi/appicon_foreground.png
deleted file mode 100644
index a28d342c1c7..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-mdpi/appicon_foreground.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-xhdpi/appicon.png b/samples/NativeAOT/Resources/mipmap-xhdpi/appicon.png
deleted file mode 100644
index b28b73c6545..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-xhdpi/appicon.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-xhdpi/appicon_background.png b/samples/NativeAOT/Resources/mipmap-xhdpi/appicon_background.png
deleted file mode 100644
index 658be3fb6a3..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-xhdpi/appicon_background.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-xhdpi/appicon_foreground.png b/samples/NativeAOT/Resources/mipmap-xhdpi/appicon_foreground.png
deleted file mode 100644
index 70a542ac03c..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-xhdpi/appicon_foreground.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-xxhdpi/appicon.png b/samples/NativeAOT/Resources/mipmap-xxhdpi/appicon.png
deleted file mode 100644
index f9af1173ead..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-xxhdpi/appicon.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-xxhdpi/appicon_background.png b/samples/NativeAOT/Resources/mipmap-xxhdpi/appicon_background.png
deleted file mode 100644
index 9171c3e4044..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-xxhdpi/appicon_background.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-xxhdpi/appicon_foreground.png b/samples/NativeAOT/Resources/mipmap-xxhdpi/appicon_foreground.png
deleted file mode 100644
index cb63bfb9f8e..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-xxhdpi/appicon_foreground.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-xxxhdpi/appicon.png b/samples/NativeAOT/Resources/mipmap-xxxhdpi/appicon.png
deleted file mode 100644
index 1d948d6b5d8..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-xxxhdpi/appicon.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-xxxhdpi/appicon_background.png b/samples/NativeAOT/Resources/mipmap-xxxhdpi/appicon_background.png
deleted file mode 100644
index 1232d8c8d23..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-xxxhdpi/appicon_background.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/mipmap-xxxhdpi/appicon_foreground.png b/samples/NativeAOT/Resources/mipmap-xxxhdpi/appicon_foreground.png
deleted file mode 100644
index 9f9c9e6d932..00000000000
Binary files a/samples/NativeAOT/Resources/mipmap-xxxhdpi/appicon_foreground.png and /dev/null differ
diff --git a/samples/NativeAOT/Resources/values/ic_launcher_background.xml b/samples/NativeAOT/Resources/values/ic_launcher_background.xml
deleted file mode 100644
index 6ec24e6413c..00000000000
--- a/samples/NativeAOT/Resources/values/ic_launcher_background.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- #2C3E50
-
\ No newline at end of file
diff --git a/samples/NativeAOT/Resources/values/strings.xml b/samples/NativeAOT/Resources/values/strings.xml
deleted file mode 100644
index 8d13608953c..00000000000
--- a/samples/NativeAOT/Resources/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
- HelloNativeAOT
- Hello, NativeAOT on Android!
-