JNI的问题?

325 阅读1分钟

JNI开发遇到个问题: 断点能走到return cipher;然后就崩了,下面有一点信息,但是看不出来原因,求助

jbyteArray cipher = env->NewByteArray(src_Len);
LOGI("AES->在堆中分配ByteArray数组对象成功,将拷贝数据到数组中");
env->SetByteArrayRegion(cipher, 0, src_Len, (jbyte *) buff);
LOGI("AES->释放内存");
free(out);
return cipher;


error:
Traceback (most recent call last):
  File "/Applications/Android Studio.app/Contents/bin/lldb/shared/jobject_printers/jstring_reader.py", line 95, in jstring_summary_provider_23
    return Reader(valobj).decode_string(TargetPlatform(23, True))
  File "/Applications/Android Studio.app/Contents/bin/lldb/shared/jobject_printers/jstring_reader.py", line 92, in decode_string
    return '"{}"'.format(bytearray(data).decode('utf-16'))
  File "/System/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/encodings/utf_16.py", line 16, in decode
    return codecs.utf_16_decode(input, errors, True)
UnicodeDecodeError: 'utf16' codec can't decode bytes in position 176-177: illegal encoding