Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8038145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:08:18+00:00 2026-06-05T03:08:18+00:00

why wouldn’t there exist a SQLite database after the app was updated to a

  • 0

why wouldn’t there exist a SQLite database after the app was updated to a new version ? How is it possible that the database is no longer present even though it did exist earlier.

(using Android 2.3.3)

Error Log
why would SQLiteOpenHelper.getWritableDatabase() cause this exception? Surely it would be clever enough to realize “oooh the db doesn’t exist, let’s create it!

note that the new SQLiteOpenHelper(context) worked OK as far as I can tell. However, I do not know whether onCreate() or onUpgrade() were triggered.

06-04 18:21:01.706 D/AndroidRuntime( 1280): Shutting down VM
06-04 18:21:01.706 W/dalvikvm( 1280): threadid=1: thread exiting with uncaught exception (group=0x40015560)
06-04 18:21:01.745 E/AndroidRuntime( 1280): FATAL EXCEPTION: main
06-04 18:21:01.745 E/AndroidRuntime( 1280): java.lang.ExceptionInInitializerError
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at myapp.com.MyActivity.onCreate(MyActivity.java:131)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.os.Looper.loop(Looper.java:130)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.app.ActivityThread.main(ActivityThread.java:3683)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at java.lang.reflect.Method.invokeNative(Native Method)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at java.lang.reflect.Method.invoke(Method.java:507)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at dalvik.system.NativeStart.main(Native Method)
06-04 18:21:01.745 E/AndroidRuntime( 1280): Caused by: android.database.sqlite.SQLiteException: unable to open database file
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.database.sqlite.SQLiteDatabase.dbopen(Native Method)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1849)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:820)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:854)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:847)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:547)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:118)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at myapp.com.storage.SQLiteStorage.<init>(SQLiteStorage.java:61)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     at myapp.com.storage.SQLiteStorage.<clinit>(SQLiteStorage.java:58)
06-04 18:21:01.745 E/AndroidRuntime( 1280):     ... 14 more
06-04 18:21:01.776 W/ActivityManager( 1002):   Force finishing activity myapp.com/.MyActivity

After I trap the exception “SQLiteException: unable to open database file”, should the app simply try to instantiate another SQLiteOpenHelper ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:08:19+00:00Added an answer on June 5, 2026 at 3:08 am

    I’ve gotten it working reliably (test case was to force close the app, delete the .db file it created, then restart the app – this requires a rooted phone to test).

    Solution:

    the SQLiteOpenHelper object (nested class within my SQLiteStorage singleton class) needed to be instantiated from Application.onCreate() so that the tables were ready by the time the service and launcher activity called their onCreate()’s

    Explanation:

    What happened is the launcher activity started the service through an intent (which also used the SQLite DB for storage) and the launcher activity also initiated the SQLiteOpenHelper.onCreate(). However, because there’s a lot of tables that needed to be created there existed a race condition and sometimes the database wasn’t ready by the time the service wanted it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wouldn't dare do anything complex in a database without transactions. There is nearly
I wouldn't say my app is text heavy...but it displays random strings sometimes that
Ordinarily I wouldn't just post an error message on SO, but after a Google
I wouldn't ask if i wasn't sure that i have 100% no idea why
I wouldn't expect so. Is there anything to point out?
Wouldn't it be better to have a method in the viewmodel that returns the
I wouldn't think its possible at all, but I'm just wondering because my friend
I know it wouldn't be exactly equivalent to $this, but is there a way
Wouldn't the touchesBegan:withEvent always fire before or after each iteration of the CADisplayLink callback?
I wouldn't use most of the classes from Zend Framework, that's why I'm looking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.