Titanium Community Questions & Answer Archive

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

java.io.FileNotFoundException - android

Hi,

i have an application which works on htc sensation and iphone but on htc wildfire and samsung galaxy i get this Error:
Error:
Wrapped java.io.FileNotFoundException:
Resources/Managers/Trails.db
(app://Managers/DatabaseManager.js#11)

i think there is some path error or name.

can you give any solutions?

thanks,
Eliza

— asked January 24th 2012 by Eliza Sapir
  • android
  • java.io.filenotfound
0 Comments

4 Answers

  • Path to .sqlite file is wrong, you need to provide additional information to get more help (where do you "install" database, where .sqlite file is located, …).

    — answered January 24th 2012 by Ivan Škugor
    permalink
    0 Comments
  • Hi Ivan,
    i do it in this way :
    DatabaseManager.dbHandler = Ti.Database.install('Trails.db', 'trails');
    the file Trails.db is in Resources File.

    — answered January 24th 2012 by Eliza Sapir
    permalink
    7 Comments
    • You need to:

      a) use comments instead of answers :)

      b) use .sqlite file, I'm not sure .db file would work. Check database KitchenSink examples: https://github.com/appcelerator/KitchenSink/tree/master/Resources/examples.

      — commented January 24th 2012 by Ivan Škugor
    • a. can you tell me how to add comments for code?
      b. this works for htc sensation and iphone so i don't think that sqliew is the problem

      and thank you very much for your help,
      Eliza

      — commented January 24th 2012 by Eliza Sapir
    • a) just like you did right now. If you want to comment on answer, it's better to use comment facility, it's easier to track discussion that way.

      b) if "Trails.db" is located in "Resources" directory, then it should work. But, I think I tried to use .db file on two Android devices and it wasn't working. On the other hand, .sqlite did not have any problem.

      — commented January 24th 2012 by Ivan Škugor
    • Ivan,
      in this link: https://github.com/appcelerator/KitchenSink/blob/master/Resources/examples/database_3.js

      that you gave me i see the same using of database file so this is not the problem.
      maybe you have another solution for me?

      — commented January 24th 2012 by Eliza Sapir
    • Yes, indeed.

      No, I don't have any other solution (as I said, I also had problems with .db files on device).

      If you can reproduce this issue, you should report it to JIRA: https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report

      — commented January 24th 2012 by Ivan Škugor
    • you said that when you tried the db you got error is that the same error i get? and i tried the solution of sqlite but i dont see any improvment which sdk of titanium you use?

      — commented January 24th 2012 by Eliza Sapir
    • I don't remember what error message was, that was a long time ago. Try solution that I proposed below. ;)

      — commented January 24th 2012 by Ivan Škugor
  • ive tried ur code and i found that it is having problems with .db , but it is working fine with .sqlite .

    — answered January 24th 2012 by Gagan Tiwari
    permalink
    1 Comment
    • i tried to change from db to sqlite but i have same problem :(

      — commented January 24th 2012 by Eliza Sapir
  • Hey Eliza, try this: Ti.Database.install('/Trails.db', 'trails');

    — answered January 24th 2012 by Ivan Škugor
    permalink
    13 Comments
    • now i get this Error: (app://Managers/DatabaseManager.js#11), no such table… when i try it with sqlite i get: Wrapped.database.sqlite….
      the sdk of my titanium studio is 1.8.0.1

      — commented January 24th 2012 by Eliza Sapir
    • OK, now your problem is solved, but second occurred. :D

      Could you tell me what's DatabaseManager.js 11th line?

      — commented January 24th 2012 by Ivan Škugor
    • And, just for the record, the problem was this: http://jira.appcelerator.org/browse/TC-556

      — commented January 24th 2012 by Ivan Škugor
    • this is the DatabaseManager.js 11th:
      DatabaseManager.dbHandler = Ti.Database.install('/Trails.sqlite', 'trails');

      and thank you so much for your help :)

      — commented January 24th 2012 by Eliza Sapir
    • Try .db file extension. :)

      — commented January 24th 2012 by Ivan Škugor
    • Location:[11,0] app://Managers/DatabaseManager.js
      
      Message:
      Wrapped java.io.IOException(app://Managers/DatabaseManager.js#11)
      

      — commented January 24th 2012 by Eliza Sapir
    • there is still error but i dont see reason :(

      — commented January 24th 2012 by Eliza Sapir
    • io exception means file is not found. Sorry, but I can't be more helpful, I really don't know why that is not working. I'm using similar code with .sqlite file and it works without a problem.

      — commented January 24th 2012 by Ivan Škugor
    • its strange that this application works on htc sensation(android)
      but on htc wildfire(android)
      this one doesnt works

      — commented January 24th 2012 by Eliza Sapir
    • tell me maybe the android sdk is a parameter in this problem?

      — commented January 24th 2012 by Eliza Sapir
    • 2.2 and 3.1

      — commented January 24th 2012 by Ivan Škugor
    • i use Google APIs Android 4.0.3

      — commented January 24th 2012 by Eliza Sapir
    • Hi ivan,

      I found the problem, maybe you can help me. i dont know why but my application works only on android version 2.3.4 and upper.

      how can i fix it?

      Thanks, Eliza

      — commented January 26th 2012 by Eliza Sapir
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.