{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-android-sdk/issues/624","labels_url":"https://api.github.com/repos/mapbox/mapbox-android-sdk/issues/624/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-android-sdk/issues/624/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-android-sdk/issues/624/events","html_url":"https://github.com/mapbox/mapbox-android-sdk/issues/624","id":56635959,"number":624,"title":"Cause Sqlite Execption when using GreenDao","user":{"login":"vasanth3008","id":2844985,"avatar_url":"https://avatars.githubusercontent.com/u/2844985?v=3","gravatar_id":"","url":"https://api.github.com/users/vasanth3008","html_url":"https://github.com/vasanth3008","followers_url":"https://api.github.com/users/vasanth3008/followers","following_url":"https://api.github.com/users/vasanth3008/following{/other_user}","gists_url":"https://api.github.com/users/vasanth3008/gists{/gist_id}","starred_url":"https://api.github.com/users/vasanth3008/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vasanth3008/subscriptions","organizations_url":"https://api.github.com/users/vasanth3008/orgs","repos_url":"https://api.github.com/users/vasanth3008/repos","events_url":"https://api.github.com/users/vasanth3008/events{/privacy}","received_events_url":"https://api.github.com/users/vasanth3008/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mapbox/mapbox-android-sdk/labels/support","name":"support","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-02-05T07:16:14Z","updated_at":"2015-05-13T21:57:11Z","closed_at":null,"body":"When i try to use this line of code\r\nOfflineMapDownloader offlineMapDownloader =OfflineMapDownloader.getOfflineMapDownloader(context);\r\nI get the following exepction.\r\n\r\n\r\nCaused by: android.database.sqlite.SQLiteException: no such table: metadata (code 1): , while compiling: SELECT value FROM metadata WHERE name='uniqueID';\r\n            at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)\r\n            at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)\r\n            at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)\r\n            at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)\r\n            at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)\r\n            at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)\r\n            at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)\r\n            at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)\r\n            at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1253)\r\n            at com.mapbox.mapboxsdk.offline.OfflineMapDatabase.sqliteMetadataForName(OfflineMapDatabase.java:144)\r\n            at com.mapbox.mapboxsdk.offline.OfflineMapDatabase.initializeDatabase(OfflineMapDatabase.java:72)\r\n            at com.mapbox.mapboxsdk.offline.OfflineMapDownloader.<init>(OfflineMapDownloader.java:114)\r\n            at com.mapbox.mapboxsdk.offline.OfflineMapDownloader.getOfflineMapDownloader(OfflineMapDownloader.java:124)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-android-sdk/issues/comments/101828340","html_url":"https://github.com/mapbox/mapbox-android-sdk/issues/624#issuecomment-101828340","issue_url":"https://api.github.com/repos/mapbox/mapbox-android-sdk/issues/624","id":101828340,"user":{"login":"shanus","id":48598,"avatar_url":"https://avatars.githubusercontent.com/u/48598?v=3","gravatar_id":"","url":"https://api.github.com/users/shanus","html_url":"https://github.com/shanus","followers_url":"https://api.github.com/users/shanus/followers","following_url":"https://api.github.com/users/shanus/following{/other_user}","gists_url":"https://api.github.com/users/shanus/gists{/gist_id}","starred_url":"https://api.github.com/users/shanus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shanus/subscriptions","organizations_url":"https://api.github.com/users/shanus/orgs","repos_url":"https://api.github.com/users/shanus/repos","events_url":"https://api.github.com/users/shanus/events{/privacy}","received_events_url":"https://api.github.com/users/shanus/received_events","type":"User","site_admin":false},"created_at":"2015-05-13T21:57:11Z","updated_at":"2015-05-13T21:57:11Z","body":"This is definitely a bug in the mapbox sdk.  The issue is that the OfflienMapDownloader constructor is looping through all the databases used by the app for each one without partial or journal in its name it is using that database name and trying to create a database for the maps.  If you want the sdk to loop through the databases t has created before you need to have it be more restrictive because it is looping through ANY sqlite database that the app is using or has created.  Then on the initializeDatabase() call you get errors because the tables may have not been created in that particular database because its version was higher in it open helper than the open helper in the mapbox sdk\r\n\r\nMaybe an approach where it looks at the databases named with a prefix of the map id would be a better approach so at least it was looking at databases that were probably created by the sdk.\r\n"}}