How to read maps offline in OSMDroid

Skip to first unread message

Rodrigo Cericatto

Apr 2, 2014, 9:56:18 AM4/2/14

Hello everyone.

My name is Rodrigo Cericatto and I'm an Android Developer that's trying to implement offline maps in Android. In the last 13 days I'm researching how to do it, with no success.

1) I tried putting a .osm map file into the /mnt/sdcard/osmdroid/ folder (as researched in the links below):

But the map is not showed. Just appears a white color!

2) I tried using links like the ones below, but again, the maps stayed white.

3) I've created an Stack Overflow topic, asking about it. But still I got no solution:

So, what am I missing? It's so weird because OSMDroid calculates routes, shows overlays, do everything, except show offline maps. And if almost everybody uses OSMDroid, there must be a way to obtain offline maps! If weren't a way, nobody would be using, right?

I've found a lot of links in web saying that or option 1) works, or 2). I've tested this applications into a Motorola Atrix (Android 2.3.6) and a Google Nexus 4 (Android 4.4.2). But for me, nothing works.

I've also researched into the OSMDroid forum:!searchin/osmdroid/offline

Unfortunatelly, again, I got no success.

So, I'm asking here into the forum for a link or source code (working) of an offline map that is showed by OSMDroid, without staying white.


Apr 3, 2014, 3:36:06 AM4/3/14
If you want to use the MapsForge rendering engine to generate offline tiles on the fly (on the device) from open street map data have a read of this thread:!searchin/osmdroid/mapsforge/osmdroid/gSieR9BF_z0/3BIIhvN95TMJ

I have this working with OSMDroid version 4.1, it's not perfect as it runs in a single thread so performance is not optimal.
But it does work!

Take a look at this java Eclipse project:

All the org.mapsforge.* packages contain the classes you need.
The* packages contain classes that enable the rendering engine to be used in Basic4Android and are not required for a 'standard' java android application:

You'd need to:

1) Add the org.mapsforge.* packages and the 'assets' file to your project.

2) Create an instance of MapsForgeTileSource and pass it to the TileSourceFactory addTileSource method.

3) In order for this to work i had to modify one OSMDroid class: org.osmdroid.tileprovider.MapTileProviderBasic

Lines #65 to #71 show the modification:

    final NetworkAvailabliltyCheck networkAvailablityCheck=(NetworkAvailabliltyCheck) aNetworkAvailablityCheck;
    final MapsForgeTileProvider mapsforgeProvider = new MapsForgeTileProvider(null, networkAvailablityCheck);
} catch (NoClassDefFoundError e){
    //    MapsforgeTileProvider not available

So you need to compile your project using the OSMDroid source code, replacing the original MapTileProviderBasic with my modified version.
(You can't use the OSMDroid .jar file).

You can read more about MapsForge here:
And the wiki page explains how to create the required 'map database' file:



Apr 3, 2014, 8:10:35 AM4/3/14
Osmdroid library can render raster tiles (i.e. png, jpg tile images) from an online tile provider
or from offline structures like directory pyramid, zip file or sqlite / mbtiles database.
It is not intended to read directly OSM or other vector data.

So the guides you mentioned say specifically what atlas format to choose at MOBAC,
'Osmdroid ZIP', Osmdroid SQLite', 'MBTiles SQLite',
where to put the offline file and how to set the tile source to map view.

Also pay attention at AndroidManifest's permissions here.



Apr 4, 2014, 1:10:46 PM4/4/14
Hi Rodrigo,

Yes, it's feasible, but not completely straightforward...

You will find an up-to-date answer here:


Terence Stigers

Apr 6, 2014, 7:16:47 PM4/6/14
I've had no trouble with this.  If you turn off the data feed [mapView.setUseDataConnection(false);] and drop a TileMill .mbtiles file in /sdcard/osmdroid it should work without a hitch. Here's a post I wrote about this a while back (including code): The post dealt with an older version of OSMDroid, but I have successfully done the same with the latest version.

Rodrigo Cericatto

Apr 6, 2014, 11:37:55 PM4/6/14
So Terence, it didn't worked for me!
I followed all your tutorial, but it didn't worked.
What I'm missing?
Could you send me your source code (with the map) for, for I try to make this finally work?
I've been trying for already 3 weeks, and I never got and OSM offline map working...

Rodrigo Cericatto

Apr 7, 2014, 12:17:51 AM4/7/14
Thanks SO MUCH for your response!!!

Terence Stigers

Apr 7, 2014, 9:59:13 AM4/7/14
I'm just guessing here, but I'm inclined to think that your problem stemmed from your map, not from OSMDroid.  I wouldn't be at all surprised if your map and your device just happened to be at divergent coordinates.  I had this problem myself a while back.  Now I have a small mbtiles map of my town (centered on my house) that I use as a working map when I'm developing.  It has saved me a lot of headaches.

baraka shaban

Mar 25, 2019, 3:51:54 PM3/25/19
to osmdroid
Hello Rodrigo Cericatto I have the same problem and my aim is to implement offline map in android studio using odmdroid. As I followed you in your post I saw finally you have got a solution for that problem. So please can you help me procedure and even source code on how to implement offline maps. my email address is
Reply all
Reply to author
0 new messages