Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Development

Reply
Developer
Posts: 23
Registered: ‎12-05-2011
My Device: PlayBook
My Carrier: Wind

SQLite Error - unable to open database file

[ Edited ]

I have developed an Android app running under Android 2.2 and above. I have had it running without issue on several PlayBooks under the OS2 developer beta. I have installed, and am a now debuggin a new version of the app. I now get the error "unable to open database file"

 

This code ran without issue on previous builds and none of the code that accesses the SQLite database has changed. Other portions of the app have changed. The time between the last functioning deployment and the deployments that now no longer work is about a week.

 

The constructor in the DBHelper is simply:

 

public class DBHelper extends SQLiteOpenHelper {

 

   public DBHelper(Context context) {

      super(context, DATABASE_NAME, null, DATABASE_VERSION);

   }

   etc... 

 

------

 

Attempts to access the database fail. For example:

 

   SQLiteDatabase db = dbhelper.getWritableDatabase();

 

fails with the message: sqlite returned: error code = 14, msg = cannot open file at source line 25467 

 

This used to run perfectly on the PlayBooks. I have not knowingly changed anything on the devices, and as stated, the code is completely unchanged. The code also runs without issue on native Android devices.

 

Any ideas?

 

Michael

 

 

 

 

 

 

Developer
Posts: 23
Registered: ‎12-05-2011
My Device: PlayBook
My Carrier: Wind

Re: SQLite Error - unable to open database file

I have installed the app on a second device and confirmed that the issue is not isolated to a single device. Again - there were no changes made to any of the code that accesses the SQLite database between the versions that once worked, and the versions that now do not work.

 

Any ideas?

New Contributor
Posts: 4
Registered: ‎12-14-2011
My Device: Playbook
My Carrier: none

Re: SQLite Error - unable to open database file

I'm running into the exact same issue.  I was able to fix the problem for a single install by running a security wipe on the device and reinstalling the OS.  After the security wipe and reinstall, the app ran once without problems.  After making a change and trying to run it again, the problem reappeared.

 

It appears as though something in either the developer tools or Android runtime is corrupting the application's installation directory (/data/data/<package name>) so that a second installation does not have the necessary permissions for database access. 

 

I would guess that the second installation is either running under a different user ID from the first, or the file permissions in the application's directory are too restrictive.  Removing the application's directory would work around this problem, but this is not possible without root access to the tablet.  Even uninstalling the app does not remove the directory.

Developer
Posts: 23
Registered: ‎12-05-2011
My Device: PlayBook
My Carrier: Wind

Re: SQLite Error - unable to open database file

Thanks for the response. This confirms that there is an issue with the PlayBook running subsequent installs of apps that use SQLite. A security wipe was going to be the next thing I was going to try, and I suspect my findings will be the same as yours.

 

  1. It seems that the OS needs to provide a means to completely eliminate all traces of an app when directed by the user. I can certainly do that on Android devices, and not need Root access to do it.
  2. The OS needs also to appropriately handle updates to Android apps that use SQLite

Hopefully RIM will clean this up soon.

 

Michael

Developer
Posts: 23
Registered: ‎12-05-2011
My Device: PlayBook
My Carrier: Wind

Re: SQLite Error - unable to open database file

Unfortunately, things have gone from bad to worse.

 

I performed a security wipe on one of the devices, and now I am left with what is essentially a dead device. The only app on the device is the browser - No BB Bridge, no App Store, nothing...

 

When I attempt to install my app and run it, the debug token is found, I can update the token, and so on, but when I attempt to run the app, I get the following error:

 

Connecting 169.254.0.1 to ADB failed!

 

And that's it, I can progress no farther. I've tried rebooting the device, rebooting the computer, different USB ports, every configuration setting in Eclipse related to debugging Android apps... all to no avail.

 

This is a most unhappy situation.

New Contributor
Posts: 4
Registered: ‎12-14-2011
My Device: Playbook
My Carrier: none

Re: SQLite Error - unable to open database file

I ran into the same issue after running a security wipe.  The fix was to downgrade the device from the 2.0 beta to the non-beta release.  Then, reinstall the 2.0 beta.  You can find instructions for the downgrade here:

 

http://supportforums.blackberry.com/t5/BlackBerry-Plug-in-for-Android/Downgrading-From-Tablet-OS-2-0...

Developer
Posts: 23
Registered: ‎12-05-2011
My Device: PlayBook
My Carrier: Wind

Re: SQLite Error - unable to open database file

Thanks Dave,

 

I will try the downgrade over the next few days.

 

Michael

Developer
Posts: 23
Registered: ‎12-05-2011
My Device: PlayBook
My Carrier: Wind

Re: SQLite Error - unable to open database file

Thanks for the link. The device has been restored to its "fresh from the store" state.

 

Michael

Highlighted
New Contributor
Posts: 8
Registered: ‎10-21-2011
My Device: Developer
My Carrier: NA

Re: SQLite Error - unable to open database file

Did you ever find a fix for the sql lite db issue?

 

I am seeing the same behavior with my app as well now

Developer
Posts: 23
Registered: ‎12-05-2011
My Device: PlayBook
My Carrier: Wind

Re: SQLite Error - unable to open database file

I've had neither the courage, nor the time to try it again. As an update takes a few hours of work to perform because of the need to backup, wipe, downgrade and then upgrade the OS, it is not to be taken lightly. The app is just about at a stage in development where it makes sense to try again. I hope to do this in the next 4-5 days. I will post the results once I have tried.

 

Michael