I am currently going though the Solana development course and I try to adapt what I learn onto an Android application. Everything is going great so far but now I am stuck when I try to serialise/deserialise data. I've tried to use Kotlin serialization to convert my data class into ByteArray with the following code: Json.encodeToString(data).encodeToByteArray()
.
However I get an error saying that
' Program logged: "panicked at 'called
Result::unwrap()
on anErr
value: Custom { kind: InvalidInput, error: "Unexpected length of input" }', src/instruction.rs:34:59"'
And when I try to deserialise the data as follow val movies = connection.getProgramAccounts( serializer = BorshAsBase64JsonArraySerializer(MovieDe.serializer()), account = PublicKey("CenYq6bDRB7p73EjsPEpiYN7uveyPUTdXkDkgUduboaN"), programAccountConfig = ProgramAccountConfig())
I've got the following error:
java.lang.OutOfMemoryError: Failed to allocate a 1866989584 byte allocation with 2097152 free bytes and 184MB until OOM, target footprint 10037792, growth limit 201326592
Would anybody have some advice on how to serialise/deserialise data on Android? Thanks in advance for your help and advice.