Jun 27, 2012

osmdroid - interact with OpenStreetMap to replace Google Map

osmdroid provides Tools/Views to interact with OpenStreetMap-Data. The OpenStreetMapView is a (almost) full/free replacement for Androids MapView class.

To build Android app with osmdroid, your app have to target Android level 3 or higher (1.5 or higher).

Also, you need to download the JARs (currently):

Add the JARs in your Java Build Path:
  • Craete a folder libs in your project.
  • Copy the JARS in the libs folder.
  • Add in Java Build Path: Right click the project -> Properties -> Java Build path, click Add JARs, to add your JARs in libs.

Modify manifest to add the permission:
  • android.permission.ACCESS_COARSE_LOCATION
  • android.permission.ACCESS_FINE_LOCATION
  • android.permission.ACCESS_WIFI_STATE
  • android.permission.ACCESS_NETWORK_STATE
  • android.permission.INTERNET
  • android.permission.WRITE_EXTERNAL_STORAGE

Reference: HowToUseJar

In next articles, I will show how to build basic map app using osmdroid.


2 comments:

  1. Hello,
    I am trying to work with osmdroid and your tutorial about this is very nice. But I have a problem. Everytime when I want to start the App I get the following Exception :

    java.lang.ClassNotFoundException: Didn't find class "org.osmdroid.views.MapView" on path: /data/app/com.exercise.OpenStreetMapView-1.apk

    Do you know a solution for this error?

    Regards
    Micka

    ReplyDelete
  2. Hi! Please tell me how I can open already downloaded map on my SD-card?

    ReplyDelete

Infolinks In Text Ads