Languages

Menu
Sites
Language
Parsing Json [answered]

[This is Possibly a Bug in Tizen Studio 2.5 when Targeting Tizen 2.3.2]

 I was trying to parse some JSON in a Native app for the Gear. I have a Gear S2 as my test hardware.

I've written the following. 

#include <json-glib.h>

JsonParser* jsonParser = NULL;
GError *error = NULL;
jsonParser = json_parser_new();

if(jsonParser == NULL) {
	fputs("failed to create parser", stderr);
	exit(7);
}

When I try this in the 3.0 emulator it works fine. If I try it in a 2.3.2 emulator or on my test hardware the call to json_parser_new() returns NULL. Should this work on 2.3.2? If not what is the recommended parser?

Edited by: Joel Ivory Johnson on 11 Oct, 2018
View Selected Answer

Responses

22 Replies
K Johnson

I guess the problem is somewhere in your development environment because it's working properly for me in Tizen Wearable Version 2.3.2(both in emulator and device).

For the below callback I'm getting output as the attached image.

static void func(void *data, Evas_Object *obj, void *event_info)
{
    JsonParser* jsonParser = NULL;
	GError *error = NULL;
	jsonParser = json_parser_new();

	if(jsonParser == NULL) {
		dlog_print(DLOG_DEBUG, "test", "failed to create parser");
	}
	else dlog_print(DLOG_DEBUG, "test", "success");
}

Output:

 

treeger

Thank you for your help

Joel Ivory Johnson

Are you using Tizen Studio 2.5? Which operating system are you developing on? I want to see what happens if I try the same. 

K Johnson

I'm using Tizen Studio 2.4 on ubuntu 16.04 LTS. Yeah, that would be great.

Joel Ivory Johnson

 So I've encountered the identical failure onUbuntu 16 and Tizen Studio 2.5, Ubuntu 18 and Tizen Studio 2.5, and Windows 10 Creator's Edition and Tizen Studio 2.5. I', starting to think there is a problem with Tizen Studio 2.5. And I can't find that Tizen Studio 2.4 is available for download. Does anyone know if it is still available from any official sources?

Joel Ivory Johnson

Found the direct link. Hoping this works!

 

http://download.tizen.org/sdk/Installer/tizen-studio_2.4/

 

K Johnson

So the problem is with Tizen Studio version 2.5. Did you try with version 2.4? I hope it'll work as it worked in my case.

Joel Ivory Johnson

It's time to throw in the towel. While I was able to find an older installer there are still components that it must download. In a nutshell nomatter what I end up with Tizen Studio 2.5 on my system. I **cannot* get Tizen 2.4 installed on this machine. I've reinstalled the operating system 2 or 3 times today to make sure that I was starting from a clean slate for the things I installed. 

 

Since I experience the problem across all of my machines and operating systems running 2.5 and you don't experience the problem on 2.4 then I can only provisionally conclude that the problem is with Tizen Studio 2.5 I can find no way to get 2.4 installed. 

The code does work for me when I target Tizen 3.0. So I'm just going to drop support of anything prior to Tizen 3.0 for my application (The choice to support it isn't available to me since I can't get an environment that will work with it). 

Such a shame. :-(

 

K Johnson

From Configuration window of Package Manager you can turn off the Auto Update option. You can also use a specific Tizen Studio version from the list as below image. Just select a snapshot version and click ok. It'll prompt you to uninstall all the packages of the current version. Please give it a try.

Joel Ivory Johnson

 Cool, that got me back down to version 2.4. Now I've got to figure out what the problem is with the debugger attaching to the emulator. 

 

Cannot launch application with GDBClient.
Error in final launch sequence
Failed to execute MI command:
-target-select remote 127.0.0.1:26114
Error message from debugger back end:
Remote communication error.  Target disconnected.: Connection reset by peer.
Remote communication error.  Target disconnected.: Connection reset by peer.
Joel Ivory Johnson

@ K-Johnson - Let me say thankyou for your willingness to help me with this problem. I appreciate the assistance.

On Ubuntu:
Unfortunately the problem is intractable. Before I had resolution for the debug problem I recalled that I could still view the output logs and ran the app. json_parser_new() was still returning NULL. Looking through these forums I found a thread where the debug problem was said to go away on it's own by simply restarting the tools a few times. I tried that and was able to get the debugger to attach and verified the same problem occurred through variable inspection.

 The 3.0 emulator isn't completely functional. It initially returned an error saying that SAP needs to be installed manually. According to another thread in these forums this has been resolved by ininstalling and reinsalling the wearable extensions. I tried this and the end result is that instead of only the SAP error I now get two errors when I start the 3.0 emulator (stating that SAP **and** CERT must be installed Manually). 

On Windows: The problem is still pretty much in it's original state. json_parser_new() always returns NULL. 

My experience has been that the Tizen IDE is buggy as hell. I think the various failures I'm getting (inconsistency in execution of json_parser_new(), ability to attach to a debugger, ability to install without errors) are some pretty baseline things. Between this and some other problems I encountered with the IDE that haven't been discussed here I think I've exhausted my efforts in trying to get something very simple running. I hate to say it, but I think I'll have much more productivity working on 

K Johnson

Your effort towards solving this issue is appreciable too. As you've searched and tried different solutions already provided in this forum, I've very less in my hand to suggest you. Over and above, would you please try a little bit more by deleting 3.0 wearable packages, emulators and reinstalling a fresh one? 

Note: According to Maik Riechel's last reply in this post, the similar problem was resolved by the installation on a different machine. It may become a last option for you to try.

 

K Johnson

Hi Joel Ivory Johnson,

Interesting point is  json_parser_new() is working for me in Tizen Studio 2.5 with wearable emulator 2.3.2 too. Please check attached image. So I guess the problem may not be in Tizen Studio 2.5.

 

Joel Ivory Johnson
Over and above, would you please try a little bit more by deleting 3.0 wearable packages, emulators and reinstalling a fresh one?

I just tried this on Mac OS X Mojave using two methods. First I went to the package manager and removed both the 2.3.2 tools and 3.0 tools, then just added the 2.3.2 tools. My outcome was the same for this run; json_parser_new() == NULL.

For the second try I completely removed Tizen Studio. Then I reinstalled it and only selected the 2.3.2 tools. I did not install the tools for any other Tizen version nor have I installed any of the extensions. The outcome is still NULL == json_parser_new().

To summarize my attempts:

OS Version Tizen Studio Version Result
Ubuntu 16 LTS Clean Install 2.4

json_parser_new()== NULL

Encountered other issues too

Ubuntu 16 LTS Clean Install 2.5 json_parser_new()== NULL
Ubuntu 18 LTS Clean Install 2.4 json_parser_new()== NULL
Ubuntu 18 LTS Clean Install 2.5 json_parser_new()== NULL
Mac OS X High Siera Clean Install 2.5 json_parser_new()== NULL
Mac OS X Movaje Clean Install 2.5 json_parser_new()== NULL
Windows 10 Creator's Edition 2.5 json_parser_new()== NULL
Windows 10 Creator's Edition 2.4 json_parser_new()== NULL

For the instances above marked as "Clean Installation" I formatted the hard drive before installing the OS, then installing the Tizen prerequisits (ex: Java, other packages).  json_parser_new() returns NULL when I use Tizen  2.3.2 either in the emulator or on either of the watches I have that run 2.3.2. If I call json_paerser_new() twice in the same program then the debugger detaches and the program crashes. I can reliably and repeatedly repeat this across the various operating systems. This does not occur for me on the 3.0 emulator. 

I would almost guess that the problem is in the 2.3.2 emulator, but I see the exact same behaviour on hardware.

I thought the problem might have been in the code. But creating a new json parser is not anything in the json documentation or even the json-glib and g-object source code that relies on any OS specific functionality (I examined the json-glib source code while I was trying to figure out what was going on, assuming that Tizen doesn't use some modified version of it). Also one might expect a problem in the code to have problem execution across both the 2.3 and 3.0 emulator. 

I thought that perhaps there was something wrong with my initial program, but I see the same behaviour in any program even when I made one that **only** attempted to creat the parser and then returned. 

I considered that there was something wrong with my programming environment. But as you can see from the table above I encounter this across many environments. 

At this point I'm left speculating this is a problem that someone will encounter if their Tizen Studio environment were recently setup. I can't imagine there is something that I am doing that is uniformly screwing up the environment across different operating systems and operating system versions. 

Mark as answer
Donghun Kwak

I checked glib version at Tizen 2.3.2 

glib2-2.32.3-4.7.i586
json-glib-0.0.1-2.13.i586

 

glib 2.32 , need to call g_type_init() api at initialize time.

so fix your code below 

#include <json-glib.h>
 
JsonParser* jsonParser = NULL;
GError *error = NULL;
 
g_type_init();
 
jsonParser = json_parser_new();
 
if(jsonParser == NULL) {
fputs("failed to create parser", stderr);
exit(7);
}

 

Joel Ivory Johnson

Thanks. I never would have figured that out. After some searching on that I found a conditional compile statement concerning it. 

#if !GLIB_CHECK_VERSION(2, 35, 0)
	g_type_init();
#endif

Perhaps they are targeting devices that have a newer version of glib, but some of the other Tizen samples and exemple code never make this call (like this one)

laura lorde

I will recommend it to my friends. This posts is very interesting, thanks for letting us know.

Brian Wilde

This post is so interesting and informative

treeger

I have learned a lot from papa's pizzeria. Learn how to make a pizza, how to manage a restaurant, and learn how to react to the customers.

Shakespeare

I love this game. It's so fun

Hodges

This cooking game is so fun

Thank for sharing