dotnet / dotnet/android

[fsharp] Java.Lang.ClassNotFoundException: Didn't find class "<..>" on path: DexPathList

Open
#10,081 17 comments 0 reactions 3 assignees Assigned to @jonpryor View on GitHub
Area: App+Library Build need-attention
Dominant language
C#
Stars
2.1k
Forks
579
Avg merge
1d 19h
Merged PRs (30d)
252

Description

### Android framework version

net10.0-android (Preview)

### Affected platform version

10.0.100-preview.3.25201.16

### Description

I'm inheriting from `MediaDataSource` in order to play audio in `Android.Media.MediaPlayer` from an in-memory mp3.

```csharp
internal class StreamMediaDataSource(byte[] data) : Android.Media.MediaDataSource
{
// ...
}
```

It worked just fine with `10.0.100-preview.2.25164.34`, but with `10.0.100-preview.3.25201.16` I now get an exception during the instantiation of this class:

```
Java.Lang.ClassNotFoundException: Didn't find class "crc64467b05f37239e7a6.StreamMediaDataSource" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib64, /system_ext/lib64, /system/lib64, /system_ext/lib64]]
at Java.Interop.JniEnvironment.Types.TryFindClass(String classname, Boolean throwOnError)
at Java.Interop.JniType..ctor(String classname)
at Java.Interop.JniPeerMembers.JniInstanceMethods..ctor(Type declaringType)
at Java.Interop.JniPeerMembers.JniInstanceMethods.GetConstructorsForType(Type declaringType)
at Java.Interop.JniPeerMembers.JniInstanceMethods.StartCreateInstance(String constructorSignature, Type declaringType, JniArgumentValue* parameters)
at Android.Media.MediaDataSource..ctor()
at Plugin.Maui.Audio.StreamMediaDataSource..ctor(Byte[] data)
at Plugin.Maui.Audio.AudioPlayer.Play(Byte[] data)
```

If I use global.json to pin the SDK to Preview 2, the problem disappears.

### Steps to Reproduce

I failed to reproduce it in an empty project, so at the moment I'm in the dark with respect to what exactly might be the thing that makes a difference.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.