Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

JSON Error With Phonegap Build

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • JSON Error With Phonegap Build

    Hi,

    I converted my phonegap app to use client-side data caching instead of SQL access. I have a couple of list controls that I populate with data from the cache using the setListColumnsAndPopulate method.

    So I can run the app using 'Live Preview" and it will also run in Chrome without any issues. However, when I try it on Android tablet after phonegap build, I get this error as soon as the app starts:

    ----------------------------------------------
    Alert
    Error - Could not JSON.parse data in file
    ----------------------------------------------

    I don't really know where to start debugging this ? Any help appreciated.

    Thanks,
    Greg

  • #2
    Re: JSON Error With Phonegap Build

    You'd have to post a sample UX showing this error. Where is the error occurring? At what point? Is it setListColumnsAndPopupate? Is it the data cache?

    Android is very simple to set up for debugging. Search the Web for Android debugging and you'll find how to set it up on your device... and how it works when the device is connected via a cable to your PC.
    Once you have debugging set up, the console errors will give you more detail.

    Comment


    • #3
      Re: JSON Error With Phonegap Build

      It looks like the error is occurring with the data cache. Android is trying to load a file, "http://192.168.0.4:1580/EDCMobile/A5SessionFile/jobs.json" and can't find it. (jobs is one of the entries in my client-side data cache). I checked the link to the file, and the directory "A5SessionFile" doesn't exist.

      Here is the excerpt from logcat:
      12-08 13:03:10.964 18460-18510/au.com.hymans.mobile_edc D/FileTransfer: download http://192.168.0.4:1580/EDCMobile/A5...File/jobs.json to file:///data/user/0/au.com.hymans.mobile_edc/files/files/__AADataCache/A5SessionFile/jobs.json
      12-08 13:03:10.966 18460-18533/au.com.hymans.mobile_edc D/FileTransfer: Download file:http://192.168.0.4:1580/EDCMobile/A5...File/jobs.json
      12-08 13:03:10.972 18460-18533/au.com.hymans.mobile_edc D/NetworkSecurityConfig: No Network Security Config specified, using platform default
      12-08 13:03:10.978 18460-18533/au.com.hymans.mobile_edc I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
      12-08 13:03:10.979 18460-18533/au.com.hymans.mobile_edc I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
      12-08 13:03:11.042 18460-18533/au.com.hymans.mobile_edc E/FileTransfer: {"code":1,"source":"http:\/\/192.168.0.4:1580\/EDCMobile\/A5SessionFile\/jobs.json","target":"file:\/\/\/data\/user\/0\/au.com.hymans.mobile_edc\/files\/files\/__AADataCache\/A5SessionFile\/jobs.json","body":"\u001f�\b\u0000��*Z\u0000�]PAn�0\u0010�#��\u0001�\t\u0004�HV��\u0004.�D�\u001ezt�ld��v@�^z�����j�.�Ӯ��Z\u0010����N\u00052\u001e��^aU�%�\u001b\u000f{3iN�\/\u0019�$����g�\u0016�7\u00033��\u0002����#���\u0011H���� \u0015�zsA���fp��\u0019\n\u000f�@\u0007��h\u0004��B:ph�h�pkL\u0007m��s\u001b<�Z��A��\u000f�\u0016��;*3�P{�$\u001d)VY\u000e��T���X���\n��

      Comment


      • #4
        Re: JSON Error With Phonegap Build

        Here is the remainer of the error from Logcat:
        java.io.FileNotFoundException: http://192.168.0.4:1580/EDCMobile/A5...File/jobs.json
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:254)
        at org.apache.cordova.filetransfer.FileTransfer.getInputStream(FileTransfer.java:588)
        at org.apache.cordova.filetransfer.FileTransfer.access$500(FileTransfer.java:69)
        at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:878)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:762)

        Not sure why it is trying to access a json file on the server (192.168.0.4 is the ip of the server). I would have thought it would be sending sql to get the data from the db, then populating the data to a json file on the client?

        Any help appreciated.

        Thanks,
        Greg

        Comment


        • #5
          Re: JSON Error With Phonegap Build

          Are the versions for your plugins set?

          Comment


          • #6
            Re: JSON Error With Phonegap Build

            Yes. However it keep generating duplicates without the version numbers everytime I do a save and submit to phonegap.

            Comment


            • #7
              Re: JSON Error With Phonegap Build

              Right... then you're using an Alpha version that is not the current pre-release? And it's a mess.

              So, Save only... and then in the Confirmation dialog that pops up, click the link "Click here to view/edit the PhoneGap Build XML configuration file". Check your plugins for versions... delete the duplicates... save it... and then, when you're returned to the Confirmation dialog, click Submit.

              Comment


              • #8
                Re: JSON Error With Phonegap Build

                Same error......any other ideas?

                Comment


                • #9
                  Re: JSON Error With Phonegap Build

                  You'll have to submit the issue to Alpha.

                  Comment


                  • #10
                    Re: JSON Error With Phonegap Build

                    Try using the PreRelease ONLY for the phonegap publishing. It is working for us, although it could cause other issues. Try it and let me know how it goes. I have asked Selwyn when the Stable verison will be updated, and I'm hoping very soon.

                    Comment


                    • #11
                      Re: JSON Error With Phonegap Build

                      That's unknowingly dangerous. You've no idea what's going on behind the scenes while Alpha is generating the code needed for PhoneGap Build. You're taking a component developed and tested in one version and pushing it through processes in a much higher version. You've no idea if, when, where, it could break.

                      Comment


                      • #12
                        Re: JSON Error With Phonegap Build

                        Will stick with the current release in that case. It is building without an issue if I follow the instructions provided by David to modify the config.xml before submit.

                        Back to the original issue, I had a change to my approach re using client-side data cache. After it became obvious it would be a major effort to sync changes back to the cache, and then sync the cache back to the db, I have eliminated the data cache and converted my drop-down controls to list controls. That way I can setup a hierarchy of list controls, and use the persist feature of the parent list control to cache the data for offline use, and also be able to sync back to the db once back online.

                        Eliminating the data cache seems to have fixed the JSON parse error.

                        Greg

                        Comment


                        • #13
                          Re: JSON Error With Phonegap Build

                          Hey David, you are right - but it worked fine. The new stable release fixes the issue though, so we only had a short period of time to worry about.

                          Comment


                          • #14
                            Re: JSON Error With Phonegap Build

                            No such thing as a new stable release... just a new official release. Check out the new pre-releases which fix the official release.

                            Comment

                            Working...
                            X