Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong return type: androidx/media3/common/SimpleBasePlayer$State$Builder.Build() #1031

Open
markusroessler opened this issue Nov 2, 2024 · 1 comment

Comments

@markusroessler
Copy link

Android framework version

net8.0-android

Affected platform version

.NET 8.0.403 / Xamarin.AndroidX.Media3.Common 1.4.1

Description

The method androidx/media3/common/SimpleBasePlayer$State$Builder.Build() currently returns Java.Lang.Object instead of androidx/media3/common/SimpleBasePlayer$State.
This leads to a NoSuchMethodException at runtime.
See Android docs: https://developer.android.com/reference/androidx/media3/common/SimpleBasePlayer.State.Builder#build()

Steps to Reproduce

Just invoke the method androidx/media3/common/SimpleBasePlayer$State$Builder.Build()

Did you find any workaround?

yes:

private unsafe State? Build(SimpleBasePlayer.State.Builder builder)
       {
           var objRef = builder.JniPeerMembers.InstanceMethods.InvokeAbstractObjectMethod("build.()Landroidx/media3/common/SimpleBasePlayer$State;", builder, null);
           return GetObject<State>(objRef.Handle, JniHandleOwnership.TransferLocalRef);
       }

Relevant log output

[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.NoSuchMethodError: no non-static method "Landroidx/media3/common/SimpleBasePlayer$State$Builder;.build()Ljava/lang/Object;"
[mono-rt]    at Java.Interop.JniEnvironment.InstanceMethods.GetMethodID(JniObjectReference type, String name, String signature) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/net7.0/JniEnvironment.g.cs:line 19947
[mono-rt]    at Java.Interop.JniType.GetInstanceMethod(String name, String signature) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniType.cs:line 250
[mono-rt]    at Java.Interop.JniPeerMembers.JniInstanceMethods.GetMethodInfo(String method, String signature) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs:line 126
[mono-rt]    at Java.Interop.JniPeerMembers.JniInstanceMethods.GetMethodInfo(String encodedMember) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs:line 93
[mono-rt]    at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeAbstractObjectMethod(String encodedMember, IJavaPeerable self, JniArgumentValue* parameters) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:line 843
[mono-rt]    at AndroidX.Media3.Common.SimpleBasePlayer.State.Builder.Build() in D:\a\_work\1\s\generated\androidx.media3.media3-common\obj\Release\net8.0-android\generated\src\AndroidX.Media3.Common.SimpleBasePlayer.cs:line 1892
[mono-rt]    at xxx.Maui.Blazor.MainActivity.CustomPlayer..ctor(Looper applicationLooper) in D:\xxx\xxx\xxx.Maui.Blazor\Platforms\Android\MainActivity.cs:line 36
[mono-rt]    at xxx.Maui.Blazor.MainActivity.OnStart() in D:\xxx\xxxApp\xxx.Maui.Blazor\Platforms\Android\MainActivity.cs:line 21
[mono-rt]    at Android.App.Activity.n_OnStart(IntPtr jnienv, IntPtr native__this) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Android.App.Activity.cs:line 5183
[mono-rt]    at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:line 22
[mono-rt]   --- End of managed Java.Lang.NoSuchMethodError stack trace ---
@ne0rrmatrix
Copy link
Contributor

Remove-node was used on that class here:

path="/api/package[@name='androidx.media3.exoplayer']/class[@name='SimpleExoPlayer']"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants