CommunityToolkit / CommunityToolkit/Maui

[BUG] MediaElement throw a `MissingMethodException`

Open
#2,791 7 comments 1 reaction 0 assignees View on GitHub
bug unverified
Dominant language
C#
Stars
2.7k
Forks
500
Avg merge
2d 14h
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Did you read the "Reporting a bug" section on Contributing file?

- [x] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

### Current Behavior

When using `CommunityToolkit.Maui.MediaElement` (6.1.1), and referencing a version of `Xamarin.AndroidX.Media3.ExoPlayer` higher than `1.6.1.1`, the application crashes at runtime with a `System.MissingMethodException`.

The error occurs when the binding attempts to access `IExoPlayer.get_PlayerError()`. This method is expected to return an `ExoPlaybackException`, but starting from Media3.ExoPlayer `1.6.1.2`, it appears the method has either been removed, renamed, or its return type changed, breaking the generated binding.

📛 **Exception thrown**:

`System.MissingMethodException: Method not found: AndroidX.Media3.ExoPlayer.ExoPlaybackException AndroidX.Media3.ExoPlayer.IExoPlayer.get_PlayerError()`

This crash occurs even though the NuGet dependency allows `(>= 1.5.0)`, which suggests newer versions are supported — but in practice, versions above `1.6.1.1` are **not compatible**.

### Expected Behavior

Either:
- The toolkit should update its binding to support Media3.ExoPlayer versions 1.6.1.2 and above,
**OR**
- The NuGet dependency should be pinned to <= 1.6.1.1 explicitly (e.g., "[1.5.0, 1.6.1.2)"), to prevent incompatible versions from being resolved.

### Steps To Reproduce

1. Create a new .NET MAUI app
2. Add CommunityToolkit.Maui.MediaElement (version 6.1.1)
3. Add a PackageReference to Xamarin.AndroidX.Media3.ExoPlayer version 1.6.1.2 or 1.7.1
4. Use MediaElement to play any media
5. App crashes at runtime with:

System.MissingMethodException: Method not found: AndroidX.Media3.ExoPlayer.ExoPlaybackException AndroidX.Media3.ExoPlayer.IExoPlayer.get_PlayerError()

### Link to public reproduction project repository

https://github.com/AntoninLolivier/MediaElementMissingMethodRepro.git

### Environment

```markdown
- .NET MAUI CommunityToolkit: 6.1.1
- OS: Windows 11
- .NET MAUI: 9
```

### Anything else?

- `project.assets.json` confirms that the expected dependency is Media3.ExoPlayer 1.5.0
- The NuGet dependency version range allows (>= 1.5.0), so NuGet may auto-resolve to newer, incompatible versions
- Method `getPlayerError()` returned ExoPlaybackException in 1.5.0 → 1.6.1.1
- Breaking change observed in 1.6.1.2 and above: method no longer present with expected JNI signature
- ✅ Known working version: 1.6.1.1
- ❌ Known broken versions: 1.6.1.2, 1.7.1
- ❗️ Exception:
System.MissingMethodException: Method not found: AndroidX.Media3.ExoPlayer.ExoPlaybackException AndroidX.Media3.ExoPlayer.IExoPlayer.get_PlayerError()

Contributor guide

Open the contributing guide

Research direction

Start with the linked MediaElementMissingMethodRepro project and reproduce the crash using Xamarin.AndroidX.Media3.ExoPlayer 1.6.1.2 or 1.7.1. Inspect the MediaElement binding and package dependency configuration around IExoPlayer.get_PlayerError(), then verify that newer Media3 versions work or that resolution is limited to the known compatible range.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.