godotengine / godotengine/godot
JNI Error, cant call Android plugin method with ByteArray (equivalent of java's byte[]) as return
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproduced in 4.3-stable (mono)
### System information
Android ARM64
### Issue description
Any method that returns a ByteArray (kotlin, java's byte[]) can't be called from C#:
```kotlin
@UsedByGodot
fun testByteArray(): ByteArray {
...
}
```
No crash will occur but the pcall don't work too:
```
.reprobugandroidjni/com.godot.game.GodotApp]#1(BLAST Consumer)1: File name too long
08-24 18:46:53.227 26176 26216 V Godot : OnGodotSetupCompleted
08-24 18:46:53.322 26176 26216 E godot : USER ERROR: Method/function failed. Returning: Variant()
08-24 18:46:53.322 26176 26216 E godot : at: callp (platform/android/api/jni_singleton.h:185)
08-24 18:46:53.326 26176 26216 I godot : System.Byte[]
```
Changing the method for the following API without these types works:
```kotlin
@UsedByGodot
fun testByteArray(): String {
...
}
```
### Steps to reproduce
Create an android plugin with an exposed method that has Dictionary as argument or ByteArray (byte[]) as return and call it from C#.
### Minimal reproduction project (MRP)
[repro.zip](https://github.com/user-attachments/files/16738071/repro.zip)
Contributor guide
Assessment
This issue has not been assessed yet.