Quick PhoneGap build gotcha

Posted on 25 Mar 2011

I will be blogging a lot more about mobile development it seems, having now ended up becoming both an overnight iOS and Android developer. Loving both platforms, but also for the simple stuff, loving PhoneGap, the sort of html and javascript with a library framework for both.

One quick Gotcha before I blog properly: the build script doesn't work if you have spaces in your project path. To fix this, just wrap quotes round the line in the Copy PhoneGap Javascript build step.

Screenshot of build steps

Change:

find ${PROJECT_DIR}/www | xargs grep 'src[ 	]*=[ 	]*[\'\"]phonegap.*.*.js[\'\"]' -sl | xargs -L1 sed -i "" "s/src[ 	]*=[ 	]*[\'\"]phonegap.*.*.js[\'\"]/src=\"phonegap.${pgver}.min.js\"/g"

To:

find "${PROJECT_DIR}/www" | xargs grep 'src[ 	]*=[ 	]*[\'\"]phonegap.*.*.js[\'\"]' -sl | xargs -L1 sed -i "" "s/src[ 	]*=[ 	]*[\'\"]phonegap.*.*.js[\'\"]/src=\"phonegap.${pgver}.min.js\"/g"

See that? Yep, just the quotes and you'll be fine and get nice clean javascript output in the right place.

Hope that helps. There will be lots more on PhoneGap, iOS and Android coming shortly, both of the native and the html kludge variety. Oh, and for the pop quiz, do you think that maybe things like PhoneGap might not be why there is no Nitro in UIWebView. Discuss (actually, don't it'll just be a flamewar).

StackOverflow Flair

profile for Simon Elliston Ball at Stack Overflow, Q&A for professional and enthusiast programmers