-
6 Nov 2012 2:08 AM #1
PhoneGap object is not created in production build
PhoneGap object is not created in production build
REQUIRED INFORMATION
Ext version tested:- Sencha Touch 2.1.0-rc2
- Chrome Version 22.0.1229.94 m (Windows 7)
- Safari 5.1.7 (Windows 7)
- DOCTYPE html
Trying to combine Sencha Touch with PhoneGap, the phonegap object is not created on a production build (CMD: 'sencha app build production').- Running the application in dev mode (before running any build) works just fine, and the 'PhoneGap' object is created.
- The testing build also works.
- When trying to run the production build, the PhoneGap 'deviceready' event is never fired, and the PhoneGap object is never created.
- Create a new app:
Code:sencha app generate testapp ..\testdir
- Edit the 'js' array in app.json, and add the cordova Android JS file:
Code:"js": [ { "path": "sdk/sencha-touch.js" }, { "path": "cordova-2.2.0.js", }, { "path": "app.js", "bundle": true, /* Indicates that all class dependencies are concatenated into this file when build */ "update": "delta" } ], - Creating testing & production builds (CMD: 'sencha app build testing\production )
- Running both builds in a Chrome browser, and typing 'Phonegap' in the Chrome Dev Console for both. The 'testing' build will present the 'Phonegap' object, while in the 'production' it is undefined.
- There should be no difference between 'testing' & 'production' builds on this metter.
- Running both builds in a Chrome browser, and typing 'Phonegap' in the Chrome Dev Console for both. The 'testing' build will present the 'Phonegap' object, while in the 'production' it is undefined.
As described above in the 'Steps to reproduce the problem' section.
HELPFUL INFORMATION
All the belows were tested with when trying to integrate the Android JS file (both cordova-2.1.0.js & cordova-2.2.0.js) on Chrome, Safari and also on HTC Nexus 1 (Android 2.3) and HTC 1 X (Android 4)
Operating System:- Win 7 Pro
-
11 Nov 2012 11:33 AM #2
Are there any updates?
Did anyone from the Sencha team take a look at this issue? Did you manage to reproduce it, or am I the only one experiencing this?
Please replay, even if there is no solution available.
Roei.
-
12 Nov 2012 2:31 AM #3
Workaround:
Please note that there is a workaround for this issue, if you add the cordova JS file manually to the index.html file :
This is in addition to including the file in the app.json file:Code:........ <!-- The line below must be kept intact for Sencha Command to build your application --> <script id="microloader" type="text/javascript" src="sdk/microloader/development.js"></script> <script type="text/javascript" src="cordova-2.2.0.js"></script> </head>
Please also note, that adding the cordova JS file manually to the production index.html also works ( after the 'sencha app build production' command). Therefore, (and I assume that with a very modest knowledge regarding the Sencha Touch Core ) the problem is probably with the process of automatically loading the script. This assumption is particularly weird for me, because the jquery's JS file loads normally.Code:"js": [ { "path": "sdk/sencha-touch.js" }, { "path": "cordova-2.2.0.js", "remote": true }, { "path": "jquery-1.8.2.min.js", "remote": true }, { "path": "app.js", "bundle": true, /* Indicates that all class dependencies are concatenated into this file when build */ "update": "delta" } ],
I hope that this may help locating the root cause of this issue.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote