Skip to content

System/Collections must not appear in JNI method signatures #1104

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

Open
jonpryor opened this issue Mar 4, 2025 · 1 comment
Open

System/Collections must not appear in JNI method signatures #1104

jonpryor opened this issue Mar 4, 2025 · 1 comment

Comments

@jonpryor
Copy link
Member

jonpryor commented Mar 4, 2025

Android framework version

net8.0-android, net9.0-android, Other

Affected platform version

All

Description

The string LSystem/Collections must not appear within JNI Method Signatures, because that is not the beginning of a valid Java type.

The current offender:

id_addMediaItems_ILSystem_Collections_Generic_IList_1_ = JNIEnv.GetMethodID (class_ref, "addMediaItems", "(ILSystem/Collections/Generic/IList<global::AndroidX.Media3.Common.MediaItem>;)V");

The fact that such methods are mentioned in a Transforms.xml is also not encouraging:

androidx/media3/common/Player.addMediaItems(ILSystem/Collections/Generic/IList`1;)V
androidx/media3/common/Player.addMediaItems(LSystem/Collections/Generic/IList`1;)V
androidx/media3/common/Player.setMediaItems(LSystem/Collections/Generic/IList`1;)V
androidx/media3/common/Player.setMediaItems(LSystem/Collections/Generic/IList`1;Z)V
androidx/media3/common/Player.setMediaItems(LSystem/Collections/Generic/IList`1;IJ)V
androidx/media3/common/Player.setMediaItems(LSystem/Collections/Generic/IList`1;IJ)V
androidx/media3/common/Player.replaceMediaItems(IILSystem/Collections/Generic/IList`1;)V
androidx/media3/exoplayer/ExoPlayer.replaceMediaItems(IILjava/util/List;)V

JNI method signatures must only reference Java types. Failure to do so means the Java method cannot be resolved at runtime, which will result in exceptions at runtime:

@ne0rrmatrix: It looks like in Media3 SetMediaItems and AddMediaItems is not working.

 Java.Lang.NoSuchMethodError: 'no non-static method "Landroidx/media3/exoplayer/ExoPlayerImpl;.setMediaItems(LSystem/Collections/Generic/IList<global::AndroidX.Media3.Common.MediaItem>;)V"'

Relevant log output

@jonpryor
Copy link
Member Author

jonpryor commented Mar 4, 2025

I believe (hope?) that this will be implicitly fixed as part of #1058.

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

1 participant