Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Can't get app running on Android emulator

I've got my app working on iPhone (emulator and device).

But when the app starts running on the Android emulator, it crashes as soon as I use Ti.include() with a FileNotFoundException. I've tried changing the file paths from relative to absolute and this hasn't helped.

If I run it on the device I don't get this error. Anyone have any ideas? Or, does anyone know how to get output from the device via USB debugging? Does that output the log files to a console somewhere while it runs on a device?

— asked October 4th 2010 by Charles Davison
  • android
  • emulator
0 Comments

5 Answers

  • If you set the log level to Trace, you can get details about the error.

    You can use adb -d logcat to get it in a console window or use the ddms tool which is in the ADK/tools folder.

    — answered October 7th 2010 by Don Thorp
    permalink
    0 Comments
  • Did you ever find the source of the FileNotFoundException in the emulator? I'm getting the same error.

    — answered November 16th 2010 by Mike Dosey
    permalink
    0 Comments
  • I would second Don's answer for troubleshooting, and add that your should change/touch tiapp.xml to force a full rebuild of your project. Could be that JS files were not properly copied over. Also, you can reference JS files in Ti.include relative to /, which is the Resources directory (like Ti.include('/lib/myFile.js');).

    — answered November 16th 2010 by Kevin Whinnery
    permalink
    0 Comments
  • Referencing files relative to the Resources directory using '/' doesn't seem to affect anything. When I look at the Trace output, it simply tells me to the same thing that the runtime error tells me: java.io.FileNotFoundException. But the file is right there, exactly where it should be, and the path it's reportedly looking in is exactly right. I've made sure to touch tiapp.xml and even remove the build folder completely, and the error doesn't go away.

    — answered November 16th 2010 by Mike Dosey
    permalink
    1 Comment
    • Is it in the correctly place in your build/$PLATFORM/bin/assets/Resources/ directory? Could it be a local system permission problem, causing the file not to be copied over?

      — commented November 16th 2010 by Paul Dowsett
  • Have a look in the build/android/bin/assets/Resources directory and make sure all js files have been copied.
    I've been having the same issue, and manually copying the files over fixed this.
    Really annoying!

    — answered February 1st 2011 by Daniel Tome
    permalink
    4 Comments
    • Daniel

      I have never had the issue you describe. You definitely should not suggest your workaround to anyone, as files in the build directory should not be modified. I'd suggest you post your own question, explaining your exact problem, and someone will help you to find a proper solution.

      — commented February 2nd 2011 by Paul Dowsett
    • I spent a few hours of today trying to find a solution to that annoying problem. When I realised the build script might be broken due to the fact the resources directory was getting only partially copied. When I tried copying the files over and re-trying it worked. Obviously this isn't the "best" solution but it worked for me and I'm quite happy to try and assist others that might encounter the same problems.
      Titanium for android seems like it's still in alpha state. The development process is so slow, and I am running into heaps of small bugs that really annoy me.
      Anyway, I will start posting questions about the problems I am encountering hoping that others might benefit from this. Besides from criticising my answer, do you have another solution to this fileNotFound exception?

      — commented February 2nd 2011 by Daniel Tome
    • I've just started having this issue as well… TiDeveloper 1.2.2, TiSDK 1.5.1(16bbb92), Android SDK APIs 2.2, Screen: HVGA…

      It finally copied the files over after three separate "Launch" button click cycles (e.g. click the "Launch" button, wait for the build to finish, wait for the emulator to launch, wait for the app to install, wait for the app to launch, get the FileNotFound exception, Kill the app, click the "Stop" button).

      Going to try a clean build from a new project directory and also clean up my ./ references in the Ti.include(…)'s

      — commented February 2nd 2011 by Jean-Etienne LaVallee
    • experienced the same issue. annoying :(

      — commented May 23rd 2011 by dev 1605
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.