Skip to content

Instantly share code, notes, and snippets.

@bartvde
Created November 8, 2012 10:19
Show Gist options
  • Save bartvde/4037966 to your computer and use it in GitHub Desktop.
Save bartvde/4037966 to your computer and use it in GitHub Desktop.
upgrade to Sencha Touch 2.1 and Sencha Cmd 3.0
Watch out if you have an existing build.xml in your project. Make sure you use the Sencha version.
Copying OpenLayers.js was possible before with adding the following in app.json:
```
"resources": [
"externals/openlayers/build/OpenLayers.js",
```
This does not work anymore, error is:
```
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.BasicException: The following error occurred while executing this line:
[ERR] /Users/bartvde/opengeo/git/As-Built-Viewer/mobile/.sencha/app/build-impl.xml:120: javax.script.ScriptException: sun.org.mozilla.javascript.internal.WrappedException: Wrapped com.sencha.exceptions.BasicException: Cannot find file : /Users/bartvde/opengeo/git/As-Built-Viewer/mobile/build/AsBuilt/production/externals/openlayers/build/OpenLayers.js (No such file or directory) (<Unknown source>#195) in <Unknown source> at line number 195
```
So instead add a copy action to build.xml:
```
<target name="-before-build">
<copy file="externals/openlayers/build/OpenLayers.js" todir="build/AsBuilt/production/externals/openlayers/build"/>
</target>
```
Still need to figure out if there is a variable to get the build path instead of hard-coding what I did here.
If you get something like:
```
[ERR] def was null
[ERR] failed to find meta class definition for name proxy.gxm_protocol
[ERR] BUILD FAILED
```
it means the external library GXM was not found. The paths are not taken from app.js anymore, but instead you need to add them to .sencha/app/sencha.cfg :
```
app.classpath=${app.dir}/app.js,${app.dir}/app,${app.dir}/externals/GXM/lib/GXM
```
Also, I got a run-time error in the production build, when using a Config singleton as written up here by Mitchell: http://mitchellsimoens.com/2012/06/sencha-touch-2/build-configs-using-sencha-command/ the dependencies were not met, so I had to remove the Ext.require statement in app.js and include it in the requires section of every class that uses the Config singleton.
@q4mobile
Copy link

Hey man, I am getting the same error in sencha touch2, in Config singleton , (your last line).

I use the config variables in all "models", and I try to use you advice to include "requires" not to app.js but all models classes, but seems it did not helped, I still have that issue. There is something else to change ?

Thanks !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment