PDA

View Full Version : SDK 2 beta with ST2beta: creating own build; error with required classes



sebastianwoinar
28 Feb 2012, 11:46 PM
Hello,
I'm trying to assemble my own build.

I created my jsb file with:


sencha create jsb -a index.orig.html -p project.jsb3


and the app-all.js and all-classes.js with:


sencha build -v -c -p project.jsb3 -d ./


But when I open my app which looks adjusted now:



<!DOCTYPE html><html><head>
<title>App</title>
<link rel="stylesheet" href="lib/touch/resources/css/sencha-touch.css" type="text/css">
<link rel="stylesheet" href="css/styles.css" type="text/css">
<script src="http://192.168.1.106:9999/socket.io/socket.io.js"></script>
<script src="http://192.168.1.106:9999/socket.io/socket.io-sessions.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&amp;v=3&amp;libraries=geometry"></script>
<script type="text/javascript" src="lib/touch/sencha-touch.js"></script>
<script type="text/javascript" src="app-all.js"></script>
<script type="text/javascript" src="app.js"></script>
</head><body></body></html>


I got an error-message because of my required classes:

Uncaught Error: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing required classes: TouchTest.view.Startscreen.Search, TouchTest.view.Startscreen.Register, TouchTest.view.Startscreen.Login, TouchTest.view.Startscreen.RequestPassword


Shouldn't the sencha sdk tools arrange the order of my classes in the app-all.js, that the required classes are loaded, when necessary? When I remove the requires attribute of my classes in the generated app-all.js, I do not get these error message (but are confronted by other errors *g*).

Is there a new adjusted version of the HowTo "Create your own build" with the SDK Tools 2 beta?

Thanks!
Sebastian

mitchellsimoens
29 Feb 2012, 7:36 AM
You should use sencha-touch-debug.js

sebastianwoinar
29 Feb 2012, 7:46 AM
Thanks for the hint. I will try it tomorrow an will report!

Cheers

sebastianwoinar
1 Mar 2012, 4:05 AM
Hey,
I tried to replace the sencha-touch.js file with the sencha-touch-debug.js file in my updated application.
But this does not work either. The "creating own build" - guide states that the "source" html-file should refer to the sencha-touch-debug.js script and the new one, the updated html-file for the production-mode should include the sencha-touch.js.

So, the references look good. But the application for the production-mode throws still the error



Uncaught Error: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing required classes: ...


Any more ideas?

Thanks.

mitchellsimoens
1 Mar 2012, 4:35 AM
When you are doing the build, you aren't in "production mode". After the build you should switch to sencha-touch.js

sencha-touch.js doesn't have Ext.Loader enabled where sencha-touch-debug.js does and Ext.Loader is crucial to the SDK Tools.

sebastianwoinar
1 Mar 2012, 5:47 AM
Yes, that's exactly the way, I understood it as well.

My index.orig.html file, which is used for the build looks like:



<!DOCTYPE html>
<html>
<head>
<title>App</title>
<link rel="stylesheet" href="lib/touch/resources/css/sencha-touch.css" type="text/css">

<link rel="stylesheet" href="css/styles.css" type="text/css">
<script src="http://192.168.1.106:9999/socket.io/socket.io.js"></script>
<script src="http://192.168.1.106:9999/socket.io/socket.io-sessions.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&amp;v=3&amp;libraries=geometry"></script>
<script type="text/javascript" src="lib/touch/sencha-touch-debug.js"></script>
<script type="text/javascript" src="app.js"></script>

</head>
<body>
</body>
</html>



With this, I can open my app and create the app-all.js and all-classes.js without errors.
When I open then my app with the new created app-all.js, I got these mentioned errors.

The html-file for the "production mode" looks like:



<!DOCTYPE html>
<html>
<head>
<title>App</title>
<link rel="stylesheet" href="lib/touch/resources/css/sencha-touch.css" type="text/css">
<link rel="stylesheet" href="css/styles.css" type="text/css">
<script src="http://192.168.1.106:9999/socket.io/socket.io.js"></script>
<script src="http://192.168.1.106:9999/socket.io/socket.io-sessions.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&amp;v=3&amp;libraries=geometry"></script>
<script type="text/javascript" src="lib/touch/sencha-touch.js"></script>
<script type="text/javascript" src="all-classes.js"></script>
<script type="text/javascript" src="app.js"></script>


</head>
<body>
</body>
</html>



So, only the HTML file for the production mode includes the sencha-touch.js.

Did I get it wrong, anyways?

Thanks.

mitchellsimoens
1 Mar 2012, 5:55 AM
For the most part that is correct. In your production index.html instead of having:


<script type="text/javascript" src="all-classes.js"></script>
<script type="text/javascript" src="app.js"></script>


<script type="text/javascript" src="app-all.js"></script>

all-classes.js so be unminified where app-all.js is minified and should have app.js included also so app-all has all-classes.js and app.js and is minified.

sebastianwoinar
1 Mar 2012, 6:29 AM
Mmh, I adjusted my index.html and as expected, it did not influence the error.
Then I tried to remove the "requires" field of the claimed classes inside of "app-all.js".

This helped to do not get these errors, but my browser is then not able to instantiate some of my classes, anymore - either via "Ext.create" nor using items configuration. I'm just getting an TypeError "non_object_property_call".

By the way: when I move the class definition of the class which produces the "Ext.loader" error message, further down, the error message does not occur at all, even with the "requires" field.

What else can produce these problems?