Issues with PhoneGap or PhoneGap:Build or build chain

edited July 2012 in Packaging Apps
I am having an issue with application I am writing as a weekend project; It's a frontend to the Hackerspaces.org SpaceAPI. The application works mostly fine when I run it on a Node express server, barring a few endpoints that aren't setting Access-Control-Allow-Origin * on their ends (I just ignore them currently4)

However, when I run my application through phonegap build, and install the webOS or Android builds, there are some strange things happening:

- the minified app.js contains this addPath, which is obviously not going to work: enyo.path.addPaths({layout: "/home/rrix/dev/projects/webos/spaceexplorer/enyo/tools/../../lib/layout/", onyx: "/home/rrix/dev/projects/webos/spaceexplorer/enyo/tools/../../lib/onyx/", onyx: "/home/rrix/dev/projects/webos/spaceexplorer/enyo/tools/../../lib/onyx/source/", maps: "/home/rrix/dev/projects/webos/spaceexplorer/enyo/tools/../../lib/maps/"});
- webOS log output is void of anything besides failed gets to file://home/rrix..../stuff in the maps library
- Android log output only has "D/DroidGap(29223): Origin to allow: http://127.0.0.1*"

When I run the application in Chrome or even the webOS browser or Android Chrome, there is a handmade scrim based on jmtk's spinner, and it is hidden when the last space is fetched, and the UI updates.

This doesn't happen in the PhoneGap'd versions, the spinner takes about a minute to first appear (the scrim itself should only be onscreen for 15-30 seconds while the XHRs finish) and disappears a moment later, but the data never properly loads.

With that all on the table, what would cause this to happen? If my XHRs are failing, it would keep it from going away, but not the issues I am having with the loads. Why would the XHRs fail on devices but not from a local express server? My code is up on gifhub here running tools/express.js in Node will spin up a server we can test on. There are PhoneGap:builds here.

can anyone provide some insight and see what I am missing here?

Comments

  • Is the app.js being changed by the PhoneGap Build process? Is this being run on the output of a BootPlate minification?
  • PhoneGap:Build isn't changing the app.js; I just downloaded a copy of the webOS ipk, pulled out the app.js and diff'd it.

    The app.js in question is indeed bootplate minified code. I plan to PhoneGap the full unminified code tonight to see if that's causing the failure, though the minified version works on Chrome through Express
  • edited July 2012
    that addPath call is coming from buildPathBlock in minifer.js. However, unless you dynamically use a $path reference in your code (which you usually don't), this won't cause a problem. Refs in the package.js files are automatically fixed when all the JS is concatenated together.

    I suggest manually adding some console.log statements to your index.html file and seeing how that goes. You'll really need to just look at the minified output on the webOS device and figure out what path isn't being loaded or included.
  • I just figured it out; Turns out that enyo.ajax.errors doesn't fire on Google Chrome all the time, for Access Control Allow Origin failures specifically, it would appear; by moving my error handling in to a method shared between my Chrome check and enyo.ajax.errors, I was able to make it work on devices.
  • Is this something that can be fixed in the framework? I'd be interested in updating the Ajax code.
  • I'm gonna dig in to it tonight and take a look :) I'll at least get it to a test case that fails right in mobile and fails wrong in chrome so that we can get an issue open to track it.
Sign In or Register to comment.