dotnet / dotnet/android-libraries
`System/Collections` must not appear in JNI method signatures
- Dominant language
- C#
- Stars
- 317
- Forks
- 73
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 17
Description
### 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:
https://github.com/dotnet/android-libraries/blob/8305dd036a12c9a0ac5ef4c6c35c8dd373b037c1/source/androidx.media3/media3-exoplayer/Additions/AndroidX.Media3.ExoPlayer.IExoPlayer.cs#L34
The fact that such methods are mentioned in a `Transforms.xml` is also not encouraging:
https://github.com/dotnet/android-libraries/blob/8305dd036a12c9a0ac5ef4c6c35c8dd373b037c1/source/androidx.media3/media3-exoplayer/Transforms/Metadata.xml#L7-L14
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](https://discord.com/channels/732297728826277939/732297837953679412/1336845663706812487):
> @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;)V"'
### Relevant log output
```shell
```
Contributor guide
Assessment
This issue has not been assessed yet.