jsoncpp icon indicating copy to clipboard operation
jsoncpp copied to clipboard

Json::CharReader failed to parse json string on Android

Open haoshuwen3 opened this issue 8 years ago • 2 comments

I had built jsoncpp by NDK(both ndk-r10e and ndk-r16e). LOCAL_CFLAGS := -fexceptions -std=c++11 -DJSONCPP_NO_LOCALE_SUPPORT -D__ANDROID__.

The following is my test code.

Json::CharReaderBuilder builder; Json::CharReader *reader = builder.newCharReader(); Json::Value value; string err; std::string tt = "{"face":1}"; int ll = tt.length(); if (reader->parse(json.c_str(), json.c_str() + json.length(), &value, &err)) { }

which was crash when calling the API of parse.

haoshuwen3 avatar May 07 '18 07:05 haoshuwen3

I think I may build the library something wrong. Since I test it in Android studio by Cmake method(the CFLAGS is same), it works fine. But I still can not find the reason.

haoshuwen3 avatar May 07 '18 08:05 haoshuwen3

Did you figure it out what may have been wrong? I'm having exact same issue, I use NDK14 to compile the jsoncpp as shared library, but whenever I called reader->parse(), system crash. Exact same code works fine on just pure linux environment.

smilejimin avatar Jun 04 '18 20:06 smilejimin