Skip to content
This repository has been archived by the owner on May 8, 2021. It is now read-only.

Application Error - Could not find the file utilities.js (in simulator) #21

Closed
neonarcade opened this issue Jun 7, 2011 · 14 comments
Closed
Assignees

Comments

@neonarcade
Copy link

I've tested this on 2 separate machines, both after importing the latest build of Redux.
Here's my current versions:

Titanium Studio: 1.0.0.201106032234
Titanium Mobile SDK: 1.7.0RC1
XCode/IOS Simulator: 4.3

When I run the app in Debug, I get only "finished opening all tab groups"
Then the app closes!

@dawsontoth
Copy link
Owner

Can you show Gist an app that demonstrates the issue you are seeing? I need more information, and the best way to communicate your problem is through code that I can run to reproduce it. Or are you having trouble running the test project included in the Redux repository?

@ghost ghost assigned dawsontoth Jun 7, 2011
@neonarcade
Copy link
Author

This issue is happening with just importing the Test project included. The only change I needed to make to have it compile was to move the redux.js into the actual resources folder, and remove the alias. This was giving an initial error that it couldn't find redux.js!

Additionally of note, if I change the includeGlobal to just a normal include, the utitilies.js loads, however not in a global context, so then the functions inside it aren't accessible to the tab code.

@neonarcade
Copy link
Author

Also, I just tried publishing to the simulator in 1.6.2, and everything worked fine. It's definitely an issue with 1.7.0RC1.
Knowing this, I also removed 1.7.0RC1 from my system, and did a fresh reinstall of it. Still broken!
Until I can find a fix for running Redux in 1.7, I'll just focus on 1.6.2 (sadly no live debugging though!)

@trwww
Copy link

trwww commented Jun 7, 2011

Ti Mobile 1.7 uses a common base path for Ti.include instead of having differences between iphone and android. So basically you can change Redux's include method to be this:

        include: function() {
            for (var i2 = 0, l2 = arguments.length; i2 < l2; i2++) {
                Ti.include(arguments[i2]);
            }
        },

Basically iphone no longer needs the path munging in 1.7

@salieridk
Copy link

Ive tried to change the include function in redux.js as you describe above. Didn't work for me. Any suggestions?

Thanks..

@trwww
Copy link

trwww commented Jun 16, 2011

Here is my change that makes redux work with all versions of Ti Mobile. If this doesn't work for you then I'd say you probably have something misconfigured:

$ svn diff
Index: MyApp/Resources/redux.js
===================================================================
--- MyApp/Resources/redux.js  (revision 1116)
+++ MyApp/Resources/redux.js  (working copy)
@@ -144,8 +144,12 @@
          * your root folder!
          */
         include: function() {
+            var version = Ti.version.split('.').slice(0, 2).join('.');
+            var osname = Ti.Platform.osname;
+
             // android doesn't require path juggling
-            if (Ti.Platform.osname == 'android') {
+            // Ti >= v1.7 dosen't require path juggling
+            if (osname == 'android' || version >= 1.7) {
                 for (var i2 = 0, l2 = arguments.length; i2 < l2; i2++) {
                     Ti.include(arguments[i2]);
                 }

@dawsontoth
Copy link
Owner

Fork, commit pull, request it, trwww!

@trwww
Copy link

trwww commented Jun 16, 2011

I have a fork, I'll send a pull request after work some time

@ckleinschroth
Copy link

Hello together,

I've a same issues since upgrade to the latest mobile sdk 1.7.1
The statement

includeRJSSGlobal('styles/common.rjss');

causes a Java NullPointerException in line 205 - redux.js (latest version from 05. may)

var rjss = (Ti.Filesystem.getFile(file).read() + '').replace(/[\r\t\n]/g, ' ');

any ideas?
the fix from trwww doesnt work, all files are available in build folder.
Tested with Android 2.2 emulator on linux and Titanium Mobile SDK 1.7.1

Greetings
Chris from xeconsulting

@trwww
Copy link

trwww commented Jun 25, 2011

This is a different error than what you're posting about so its not
surprising that my patch didn't fix your problem.

This error started suddenly happening to me too... I've found the piece
of code in my app that triggers the error but I'm baffled as to how it
could be happening.

Long story short, I had to change that line to this to get the error to
go away:

var rjss = (Ti.Filesystem.getFile(file + '').read() +
'').replace(/[\r\t\n]/g, ' ');

Does that work for you?

Todd W.

On 6/25/11 12:48 PM, xeconsulting wrote:

includeRJSSGlobal('styles/common.rjss');
Java NullPointerException in line 206 - redux.js
```javascript
var rjss = (Ti.Filesystem.getFile(file).read() + '').replace(/[\r\t\n]/g, ' ');

any ideas?
the fix from trwww doesnt work, all files are available in build folder.
Tested with Android 2.2 emulator on linux and Titanium Mobile SDK 1.7.1

@ckleinschroth
Copy link

HI Todd ,

thank you very much for your help!
I changed the script as you described but the error still appears.
I also noticed after the first line in app.js

Ti.include('redux.js');
Ti.include('constants.js'); <-- didnt work either, i have to use inc('constants.js')

This situation is very strange!
I've posted the source from app.js into pastie
see http://pastie.org/2125226
Any other ideas? Thank you very much for your help!

Edit: It doesnt occur with Titanium 1.6.2 only 1.7 plus

@mattheworiordan
Copy link
Contributor

I have found the include method extremely buggy in combination with another includeGlobal.

Ways to replicate the include method trying to include a file from the wrong path are as follows:

  • /app.js has a Ti.include('vendor/redux.js') and a includeGlobal('global.js')
    The logs correctly show:
    [DEBUG] include url: file://localhost/projectFolder/Resources/vendor/redux.js
    [DEBUG] include url: file://localhost/projectFolder/Resources/global.js
  • /global.js has include('vendor/underscore.js')
  • /view/startup.js has the usual Ti.include('../vendor/redux.js')
  • When /app.js does a new Window({ url: 'view/startup.js' }) an error is raised saying that underscore.js does not exist, and the logs show that the Resources folder has been removed i.e. it is adding an additional '..'
    [DEBUG] loading: /projectFolder/vendor/underscore.js, resource: projectFolder/vendor/underscore_js

Clearly a javascript file included as global which in turn includes other files causes problems with your current include method.

I've worked around this issue in the short term by simply using Ti.Include('vendor/underscore.js') in my global.js file, but it would be great if we had a proper fix for this.

@mattheworiordan
Copy link
Contributor

FYI, I kept running into issues with Redux includeGlobal trying to load files outside of the root of my application.
My fix was to simply replace the include function with the simplified code from the Android version:
include: function() { for (var i2 = 0, l2 = arguments.length; i2 < l2; i2++) { Ti.include(arguments[i2]); } },

And I have made all includeGlobal and include statements global by using something like include('/path-to-file-from-root/filename.js');

I have however not tested this on Android as my app is only iOS for now, hopefully someone else can test this solution as it seems to be more robust than the relative path version and path mungling that Redux.js currently uses.

dawsontoth pushed a commit that referenced this issue Jul 26, 2011
@dawsontoth
Copy link
Owner

I've just pushed a fix for this issue that's very similar to @trwww's approach (except I went with substring rather than a split slice join). The test project in the repo is working again with 1.7.0, 1.7.1, and 1.7.2 on iOS and Android. If you have a use case that is not working, please open up a new issue and we'll get it sorted out.

@xeconsulting: that pastie isn't enough. You reference a number of other files that you haven't provided. If you are still having issues, please make a complete Gist or pastie so that I can reproduce and fix whatever is ailing you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants