Search code examples
androidosmdroid

OSMdroid error with using .mbtiles database


I have a problem trying to use OSMDroid. I use example from here:

Example of OSMDroid

Then I use this video to create and download mbtiles map.

Video

And in my programm I have error:

    05-27 15:11:46.123: E/AndroidRuntime(22401): FATAL EXCEPTION: main
    05-27 15:11:46.123: E/AndroidRuntime(22401): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.osmdroidtestproject/com.example.osmdroidtestproject.MainActivity}: android.database.sqlite.SQLiteException: no such table: images (code 1): , while compiling: SELECT tile_data FROM images LIMIT 0,1
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.app.ActivityThread.access$600(ActivityThread.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.os.Handler.dispatchMessage(Handler.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.os.Looper.loop(Looper.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.app.ActivityThread.main(ActivityThread.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at java.lang.reflect.Method.invokeNative(Native Method)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at java.lang.reflect.Method.invoke(Method.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at dalvik.system.NativeStart.main(Native Method)
    05-27 15:11:46.123: E/AndroidRuntime(22401): Caused by: android.database.sqlite.SQLiteException: no such table: images (code 1): , while compiling: SELECT tile_data FROM images LIMIT 0,1
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at com.example.osmdroidtestproject.MBTileSource.createFromFile(MBTileSource.java:96)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at com.example.osmdroidtestproject.MBTileProvider.<init>(MBTileProvider.java:32)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at com.example.osmdroidtestproject.MainActivity.onCreate(MainActivity.java:32)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.app.Activity.performCreate(Activity.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java)
    05-27 15:11:46.123: E/AndroidRuntime(22401):    ... 12 more

Please, can you help me, how can I solve this problem? And if somebody have, could you please upload some .mbtiles sample map just to be sure that the code is working and the problem is with .mbtiles file. Any area.

Thanks a lot.


Solution

  • Caused by: android.database.sqlite.SQLiteException: no such table: images (code 1): , while compiling: SELECT tile_data FROM images LIMIT 0,1
    

    There's something wrong with the database, it couldn't find the images table. Check if there's an images table in your database.