After call the native method 'sign4Android' in .so, the app is crashed. The codes and logs are below. please help!
Codes:
extern "C" JNIEXPORT jstring JNICALL Java_com_XXX_sign_SignHelper_getSign(JNIEnv *env, jobject obj, jstring input){
const char *para = env->GetStringUTFChars(input, 0);
std::string result_c = sign4Android(para);
env->ReleaseStringUTFChars(input, para);
const char *chars = result_c.c_str();
jstring result = env->NewStringUTF(chars);
delete chars;
return result;
}
The native code method:
string sign4Android(const char* para);
Logs by using ndk-stack:
********** Crash dump: **********
Build fingerprint: 'Xiaomi/virgo/virgo:6.0.1/MMB29M/6.3.31:user/release-keys'
pid: 2610, tid: 2610,
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xca4007c8
Stack frame #00 pc 00049228 /system/lib/libc.so (arena_run_reg_alloc+87): Routine arena_run_reg_alloc at arena.c:?
Stack frame #01 pc 0004aff9 /system/lib/libc.so (je_arena_tcache_fill_small+104): Routine je_arena_tcache_fill_small at linux-atomic.c:?
Stack frame #02 pc 0005c32b /system/lib/libc.so (je_tcache_alloc_small_hard+18): Routine je_tcache_alloc_small_hard at linux-atomic.c:?
Stack frame #03 pc 00056e1d /system/lib/libc.so (je_malloc+1112): Routine je_malloc at linux-atomic.c:?
Stack frame #04 pc 00021773 /system/lib/libhwui.so: Routine ????:0
Stack frame #05 pc 0002e165 /system/lib/libhwui.so (android::uirenderer::DisplayListCanvas::drawRect(float, float, float, float, SkPaint const&)+156): Routine ????:0
Stack frame #06 pc 72ff926b /data/dalvik-cache/arm/system@framework@boot.oat (offset 0x237a000)