posm / OpenMapKitAndroid

http://openmapkit.org
BSD 3-Clause "New" or "Revised" License
128 stars 38 forks source link

Crash when MBTiles is invalid #161

Open mojodna opened 7 years ago

mojodna commented 7 years ago

With 1.1:

java.lang.RuntimeException: Unable to start activity ComponentInfo{org.redcross.openmapkit/org.redcross.openmapkit.MapActivity}: android.database.sqlite.SQLiteDatabaseCorruptException: file is encrypted or is not a database (code 26): , while compiling: SELECT value FROM metadata WHERE name = ?
    at org.redcross.openmapkit.Basemap.selectMBTilesBasemap(Basemap.java:204)
    at org.redcross.openmapkit.Basemap.<init>(Basemap.java:60)
    at org.redcross.openmapkit.MapActivity.onCreate(MapActivity.java:152)

Indeed, the MBTiles archive is not a database. Rather, it's a text file with the contents of http://posm.io.

I suspect that this happened because the list of available deployments was cached; more in #162.

(I think this was the error that was repeatedly causing OMK to crash while I was attempting to demo in Brussels.)