Skip to content

Commit

Permalink
Merge branch 'main' into dev/grendel/perfetto-integration
Browse files Browse the repository at this point in the history
* main:
  Update README (#8913)
  Bumps to xamarin/Java.Interop/main@4e893bf (#8924)
  Bump to dotnet/installer@fa261b952d 9.0.100-preview.5.24253.16 (#8921)
  [Mono.Android] Dispose of the `RunnableImplementor` on error (#8907)
  Bump NDK to r26d (#8868)
  • Loading branch information
grendello committed May 7, 2024
2 parents 771db6a + dcf9bf3 commit dcb742b
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 51 deletions.
Binary file modified Documentation/images/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions Documentation/previous-releases.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
Xamarin.Android Previous Releases
===============

Support for Xamarin.Android ended on **May 1, 2024** as per the [Xamarin Support Policy][xamarin-support-policy].

[xamarin-support-policy]: https://dotnet.microsoft.com/en-us/platform/support/policy/xamarin

However, the released installers are still available for download.

| Platform | Link |
|-----------------|--------|
| **Commercial Xamarin.Android 13.2.2 (d17-8)** for Windows+Visual Studio 2022 | [Download][commercial-d17-8-Windows-x86_64] |
| **Commercial Xamarin.Android 13.2.2 (d17-8)** for VSMac 2022 | [Download][commercial-d17-8-macOS-x86_64] |
| **Commercial Xamarin.Android 13.2 (d17-5)** for Windows+Visual Studio 2022 | [Download][commercial-d17-5-Windows-x86_64] |
| **Commercial Xamarin.Android 13.2 (d17-5)** for macOS | [Download][commercial-d17-5-macOS-x86_64] |
| **Commercial Xamarin.Android 13.1 (d17-4)** for Windows+Visual Studio 2022 | [Download][commercial-d17-4-Windows-x86_64] |
Expand Down Expand Up @@ -74,3 +82,5 @@ Xamarin.Android Previous Releases
[commercial-d17-4-macOS-x86_64]: https://aka.ms/xamarin-android-commercial-d17-4-macos
[commercial-d17-5-Windows-x86_64]: https://aka.ms/xamarin-android-commercial-d17-5-windows
[commercial-d17-5-macOS-x86_64]: https://aka.ms/xamarin-android-commercial-d17-5-macos
[commercial-d17-8-Windows-x86_64]: https://aka.ms/xamarin-android-commercial-d17-8-windows
[commercial-d17-8-macOS-x86_64]: https://aka.ms/xamarin-android-commercial-d17-8-macos
44 changes: 19 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,47 @@
<img src="Documentation/images/banner.png" alt=".NET Android banner" height="145" >
<img src="Documentation/images/banner.png" alt=".NET for Android banner" height="145" >

.NET Android
.NET for Android
===============

.NET Android provides open-source bindings of the Android SDK and tooling for use with
.NET for Android provides open-source bindings of the Android SDK and tooling for use with
.NET managed languages such as C#. This ships as an optional [.NET workload][net-workload] for .NET 6+ that can
be updated independently from .NET in order to respond to external dependency updates like new Android
platform and tooling.

While .NET Android is an essential part of [MAUI][maui-intro], it is still fully supported to be
used independently for native Android development using .NET.

This repository is also home to the classic Xamarin.Android product.
.NET for Android is part of [.NET MAUI][maui-intro], and may also be used independently for native Android development using .NET.

[net-workload]: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-workload-install
[maui-intro]: https://learn.microsoft.com/en-us/dotnet/maui/what-is-maui

# Support

.NET Android is now part of .NET 6+ and follows the same support lifecycle as the [MAUI Support Lifecycle][maui-support-lifecycle].
.NET for Android is part of .NET MAUI, since it was introduced in May 2022 as part of .NET 6, and is currently supported as described in the [.NET MAUI Support Policy][maui-support-policy].

Support for Xamarin.Android ended on **May 1, 2024** as per the [Xamarin Support Policy][xamarin-support-policy]:

Support for classic Xamarin.Android will end on **May 1, 2024** as per the [Xamarin Support Policy][xamarin-support-policy]:
> Xamarin support ended on May 1, 2024 for all Xamarin SDKs including Xamarin.Forms. Android API 34 and Xcode 15 SDKs (iOS and iPadOS 17, macOS 14) are the final versions Xamarin targets from existing Xamarin SDKs (i.e. no new APIs are planned).
> Xamarin support will end on May 1, 2024 for all classic Xamarin SDKs. Android 13 will be the final version classic Xamarin.Android will target.
Follow the [official upgrade guidance](https://learn.microsoft.com/dotnet/maui/migration) to bring your Xamarin applications to the latest version of .NET.

[maui-support-lifecycle]: https://dotnet.microsoft.com/en-us/platform/support/policy/maui
[maui-support-policy]: https://dotnet.microsoft.com/en-us/platform/support/policy/maui
[xamarin-support-policy]: https://dotnet.microsoft.com/en-us/platform/support/policy/xamarin

# Downloads

## Current
.NET for Android ships as a workload through the `dotnet` workload system in [.NET 6+][dotnet-download].

.NET Android ships as a workload through the `dotnet` workload system in [.NET 6+][dotnet-download]. See
the [workload documentation][workload-documentation] for installation commands.
In its simplest form, .NET for Android can be installed by running:

[dotnet-download]: https://dotnet.microsoft.com/en-us/download
[workload-documentation]: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-workload-install
```
dotnet workload install android
```

Classic Xamarin.Android installers are available here:
See the [.NET workload documentation][workload-documentation] for additional installation commands and options.

| Platform | Link |
|-----------------|--------|
| **Commercial Xamarin.Android 13.2.2 (d17-8)** for Windows+Visual Studio 2022 | [Download][commercial-d17-8-Windows-x86_64] |
| **Commercial Xamarin.Android 13.2.2 (d17-8)** for VSMac 2022 | [Download][commercial-d17-8-macOS-x86_64] |

[Previous Releases](Documentation/previous-releases.md) are also available for download.
[dotnet-download]: https://dotnet.microsoft.com/en-us/download
[workload-documentation]: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-workload-install

[commercial-d17-8-Windows-x86_64]: https://aka.ms/xamarin-android-commercial-d17-8-windows
[commercial-d17-8-macOS-x86_64]: https://aka.ms/xamarin-android-commercial-d17-8-macos
While no longer supported, Classic Xamarin.Android installers are still available [here](Documentation/previous-releases.md).

# Contributing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Xamarin.Android.Prepare
{
class BuildAndroidPlatforms
{
public const string AndroidNdkVersion = "26c";
public const string AndroidNdkPkgRevision = "26.2.11394342";
public const string AndroidNdkVersion = "26d";
public const string AndroidNdkPkgRevision = "26.3.11579264";
public const int NdkMinimumAPI = 21;
public const int NdkMinimumAPILegacy32 = 21;

Expand Down
20 changes: 10 additions & 10 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="9.0.100-preview.5.24229.2">
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="9.0.100-preview.5.24253.16">
<Uri>https://github.com/dotnet/installer</Uri>
<Sha>d301a122c4f9d017cdc3a506f831e2edfc124ea7</Sha>
<Sha>fa261b952d702c6bd604728fcbdb58ac071a22b1</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="9.0.0-preview.4.24223.11" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="9.0.0-preview.4.24251.3" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>d92ac1f892a7f9c00561db6541671f25f3972eed</Sha>
<Sha>4326eb7ed4d03f30ce4a4de1eb028ee76fdaaa3c</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Ref" Version="9.0.0-preview.4.24223.11" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
<Dependency Name="Microsoft.NETCore.App.Ref" Version="9.0.0-preview.4.24251.3" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>d92ac1f892a7f9c00561db6541671f25f3972eed</Sha>
<Sha>4326eb7ed4d03f30ce4a4de1eb028ee76fdaaa3c</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport" Version="9.0.0-preview.4.24215.3" CoherentParentDependency="Microsoft.NETCore.App.Ref">
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport" Version="9.0.0-preview.5.24223.2" CoherentParentDependency="Microsoft.NETCore.App.Ref">
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>19c9523f5c2dd091b49959700723af795d6ad2b4</Sha>
<Sha>53288f87c588907e8ff01f129786820fe998573c</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.4-alpha.24215.1" CoherentParentDependency="Microsoft.NET.ILLink.Tasks">
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.4-alpha.24222.1" CoherentParentDependency="Microsoft.NET.ILLink.Tasks">
<Uri>https://github.com/dotnet/cecil</Uri>
<Sha>861f49c137941b9722a43e5993ccac7716c8528c</Sha>
<Sha>4abe3e63a5d4653ca098c633644432c1395411c1</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
Expand Down
10 changes: 5 additions & 5 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project>
<!--Package versions-->
<PropertyGroup>
<MicrosoftDotnetSdkInternalPackageVersion>9.0.100-preview.5.24229.2</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftNETILLinkTasksPackageVersion>9.0.0-preview.4.24223.11</MicrosoftNETILLinkTasksPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>9.0.0-preview.4.24223.11</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftDotnetSdkInternalPackageVersion>9.0.100-preview.5.24253.16</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftNETILLinkTasksPackageVersion>9.0.0-preview.4.24251.3</MicrosoftNETILLinkTasksPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>9.0.0-preview.4.24251.3</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftDotNetApiCompatPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetApiCompatPackageVersion>
<MicrosoftDotNetBuildTasksFeedPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetBuildTasksFeedPackageVersion>
<MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>9.0.0-preview.4.24215.3</MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>
<MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>9.0.0-preview.5.24223.2</MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>
<MicrosoftNETWorkloadEmscriptenPackageVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion)</MicrosoftNETWorkloadEmscriptenPackageVersion>
<MicrosoftTemplateEngineTasksPackageVersion>7.0.100-rc.1.22410.7</MicrosoftTemplateEngineTasksPackageVersion>
<MicrosoftDotNetCecilPackageVersion>0.11.4-alpha.24215.1</MicrosoftDotNetCecilPackageVersion>
<MicrosoftDotNetCecilPackageVersion>0.11.4-alpha.24222.1</MicrosoftDotNetCecilPackageVersion>
<SystemIOHashingPackageVersion>$(MicrosoftNETCoreAppRefPackageVersion)</SystemIOHashingPackageVersion>
</PropertyGroup>
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion external/Java.Interop
35 changes: 30 additions & 5 deletions src/Mono.Android/Android.OS/Handler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,52 @@ public Handler (Action<Message> handler)

public bool Post (Action action)
{
return Post (new Java.Lang.Thread.RunnableImplementor (action, true));
var runnable = new Java.Lang.Thread.RunnableImplementor (action, removable: true);
if (Post (runnable)) {
return true;
}
runnable.Dispose ();
return false;
}

public bool PostAtFrontOfQueue (Action action)
{
return PostAtFrontOfQueue (new Java.Lang.Thread.RunnableImplementor (action, true));
var runnable = new Java.Lang.Thread.RunnableImplementor (action, removable: true);
if (PostAtFrontOfQueue (runnable)) {
return true;
}
runnable.Dispose ();
return false;
}

public bool PostAtTime (Action action, long uptimeMillis)
{
return PostAtTime (new Java.Lang.Thread.RunnableImplementor (action, true), uptimeMillis);
var runnable = new Java.Lang.Thread.RunnableImplementor (action, removable: true);
if (PostAtTime (runnable, uptimeMillis)) {
return true;
}
runnable.Dispose ();
return false;
}

public bool PostAtTime (Action action, Java.Lang.Object token, long uptimeMillis)
{
return PostAtTime (new Java.Lang.Thread.RunnableImplementor (action, true), token, uptimeMillis);
var runnable = new Java.Lang.Thread.RunnableImplementor (action, removable: true);
if (PostAtTime (runnable, token, uptimeMillis)) {
return true;
}
runnable.Dispose ();
return false;
}

public bool PostDelayed (Action action, long delayMillis)
{
return PostDelayed (new Java.Lang.Thread.RunnableImplementor (action, true), delayMillis);
var runnable = new Java.Lang.Thread.RunnableImplementor (action, removable: true);
if (PostDelayed (runnable, delayMillis)) {
return true;
}
runnable.Dispose ();
return false;
}

public void RemoveCallbacks (Action action)
Expand Down
9 changes: 8 additions & 1 deletion src/Mono.Android/Android.Runtime/JNIEnvInit.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -54,8 +55,14 @@ internal struct JnienvInitializeArgs {
[UnmanagedCallersOnly]
static unsafe void RegisterJniNatives (IntPtr typeName_ptr, int typeName_len, IntPtr jniClass, IntPtr methods_ptr, int methods_len)
{
// FIXME: https://github.com/xamarin/xamarin-android/issues/8724
[UnconditionalSuppressMessage ("Trimming", "IL2057", Justification = "Type should be preserved by the MarkJavaObjects trimmer step.")]
[return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods | DynamicallyAccessedMemberTypes.NonPublicNestedTypes)]
static Type TypeGetType (string typeName) =>
Type.GetType (typeName, throwOnError: false);

string typeName = new string ((char*) typeName_ptr, 0, typeName_len);
var type = Type.GetType (typeName);
var type = TypeGetType (typeName);
if (type == null) {
RuntimeNativeMethods.monodroid_log (LogLevel.Error,
LogCategories.Default,
Expand Down
14 changes: 12 additions & 2 deletions src/Mono.Android/Android.Views/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,22 @@ public T RequireViewById<

public bool Post (Action action)
{
return Post (new Java.Lang.Thread.RunnableImplementor (action, true));
var runnable = new Java.Lang.Thread.RunnableImplementor (action, removable: true);
if (Post (runnable)) {
return true;
}
runnable.Dispose ();
return false;
}

public bool PostDelayed (Action action, long delayMillis)
{
return PostDelayed (new Java.Lang.Thread.RunnableImplementor (action, true), delayMillis);
var runnable = new Java.Lang.Thread.RunnableImplementor (action, removable: true);
if (PostDelayed (runnable, delayMillis)) {
return true;
}
runnable.Dispose ();
return false;
}

public bool RemoveCallbacks (Action action)
Expand Down

0 comments on commit dcb742b

Please sign in to comment.