解决方法:换用NewByteArray
,然后再将jbyteArray
转换成jstring
stackoverflow上有一篇关于这个问题不错的回答:点击链接
We found a solution by sending the contents of the std::string in
jbyte array and let the java side be java and return the jstring we
could use on the C++ jni side. For us these strings are coming from
the users keyboard and I have 170k crashes in one week that says they
use emoji in character names and chat like crazy… and naming their
avatars in itself caused crashes too. So any lobby a Android 5.x user
joined would cause them to crash as soon as their client tried to
render the other players names with the characters in question. In
Android 4.x this was not an issu