osmdroid is a (almost) full/free replacement for Android's MapView (v1 API) class. It also includes a modular tile provider system with support for numerous online and offline tile sources and overlay support with built-in overlays for plotting icons, tracking location, and drawing shapes.
Current Release: 6.1.17 Sept 11, 2023
Current Development version: 6.1.18-SNAPSHOT
Next Release Version (planned): 6.1.18
Note: check your calendar, it may take up to a few days for all global mirrors to update.
Please read the osmdroid wiki for tutorials on integration.
Gradle dependency
repositories {
mavenCentral()
}
dependencies {
implementation 'org.osmdroid:osmdroid-android:<VERSION>'
}
Be sure to replace <VERSION>
with the last release version above.
Maven dependency
<dependency>
<groupId>org.osmdroid</groupId>
<artifactId>osmdroid-android</artifactId>
<version><VERSION></version>
<type>aar</type>
</dependency>
Platform or API Level (API level 8 = Platform 2.2)
Note: this just assumes you need just osmdroid-android. Other modules require higher min SDK levels.
<platform>8</platform>
You can also compile osmdroid from source or download the dependency directly from OSS or download the distribution package
We periodically publish snapshots to maven central. If you're interesting in trying it out, using the following:
repositories {
mavenCentral()
maven{
url 'https://oss.sonatype.org/content/repositories/snapshots/'
name 'OSS-Sonatype'
}
}
dependencies {
implementation 'org.osmdroid:osmdroid-android:<VERSION>-SNAPSHOT:debug@aar'
}
Use at your own risk though, it may not be stable or may have bugs or performance issues. If you run across any, please report them.
In case gradle doesn't resolve it, it can be download manually here: https://oss.sonatype.org/service/local/repositories/snapshots/content/org/osmdroid/osmdroid-android/-SNAPSHOT/osmdroid-android--SNAPSHOT.aar
Side note: gradle's cached dependencies and doesn't really handle snapshot very well.
To force gradle to update snapshots on every build, try adding this to your root build.gradle
file.
allprojects {
// forces all changing dependencies (i.e. SNAPSHOTs) to automagicially download
configurations.all {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
}
}
You can also build your project using the gradle option --refreshDependencies
Continue reading here, How-to-use-the-osmdroid-library
Related and important wiki articles
If you have a question, please view the osmdroid FAQ.
You can also view the Stack Overflow osmdroid tag and osmdroid Google Group where you can get feedback from a large pool of osmdroid users.
If you still have an issue, please check the Changelog page to see if this issue is fixed in a newer or upcoming version of osmdroid.
If think you have a legitimate bug to report then go to the Issues page to see if your issue has been reported. If your issue already exists then please contribute information that will help us track down the source of the issue. If your issue does not exist then create a new issue report. When creating an issue, please include the version of osmdroid, the Android platform target and test device you are using, and a detailed description of the problem with relevant code. It is particularly helpful if you can reproduce the problem using our OpenStreetMapViewer sample project as your starting point.
See our contributing guide
For your reference, the dashboard provides a high level overview of the repository including structure of UI classes, module dependencies, external libraries, and other components of the system.
The OSMBonusPack project adds additional functionality for use with osmdroid projects.
JDK11+ is required Gradle 7.4.2 is what we are currently using Android Studio Bumblebee (latest supported configuration as of May 2022)
./gradlew clean build
Then you can install and test the app using normal command line utils.
Or just open Android studio.
JDK11+ is required Gradle 7.4.2 is what we are currently using (latest supported configuration as of May 2022)
We recommend building from the command line.
./gradlew clean build publishToMavenLocal
In your root build.gradle
file, add mavenLocal() if not present.
allprojects {
repositories {
mavenCentral()
mavenLocal() //add this if it's missing
}
}
Then in your APK or AAR project that needs osmdroid.
implementation 'org.osmdroid:osmdroid-android:<VERSION>-SNAPSHOT:debug@aar'
Where VERSION is the version listed as the value for pom.version
in osmdroid's gradle.properties
. Note that when using the release versions from Maven Central, drop the :debug@aar
part. When using a "release" version that you build locally with gradle, you'll need :debug@aar
instead.
osmdroid is entirely community supported. There is no corporate sponsorship. No full time employees, no paid employees. It's all volunteer support, if that. If you see a problem, feel free to report, fix it and open a pull request. You have access to 100% of the source code. Maps are hard to get right and this library isn't perfect.
Please don't complain about slow response times or lack of support. You will be banned. No warnings, no second chances.
We do NOT provide map data, map tiles, imagery, etc. That is all provided by a map tile source that you select or that you provide.
Please don't complain about a map source showing you the wrong data. It's not the fault of this library.