spatialdev/mapbox-android-sdk

Name: mapbox-android-sdk

Owner: SpatialDev

Description: Open Source Maps SDK for Android

Created: 2014-12-24 15:05:50.0

Updated: 2016-05-17 20:54:36.0

Pushed: 2015-02-02 23:03:25.0

Homepage: https://mapbox.com/mapbox-android-sdk/

Size: 99442

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status

Mapbox Android SDK

An open source alternative for native maps on Android. This library lets you use Mapbox, OpenStreetMap, and other tile sources in your app, as well as overlays like GeoJSON data and interactive tooltips.

This is a fork of osmdroid, so the entire core is open source: it doesn't depend on the Google Maps SDK or any components outside of AOSP that would require the Google Play Store.

Installation

We recommend using the Mapbox Android SDK with Gradle: this will automatically install the necessary dependencies and pull the SDK binaries from the Maven Central repository ( Mapbox Android SDK on Maven Central ).

To install the current stable version add this to your build.gradle:

sitories {
mavenCentral()


ndencies {
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.5.1@aar'){
    transitive=true
}
compile ('com.cocoahero.android:geojson:1.0.0@aar'){
    transitive=true
}

To install the current SNAPSHOT version add this to your build.gradle:

sitories {
mavenCentral()
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }


ndencies {
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:0.6.0-SNAPSHOT@aar'){
    transitive=true
}

For a full example Android project incorporating the SDK in this manner, please see the Mapbox Dev Preview app.

NOTE: SDK Versions

At any given time there will be 3 different versions of the SDK to use. You're welcome to use whichever one makes the most sense for your project, just be aware that each comes with a different level of stability.

  1. Stable / Supported
  2. Currently 0.5.1
  3. SNAPSHOT
  4. Currently 0.6.0-SNAPSHOT
  5. Source
Manually / Hardcoding In Project

Download and include the mapbox-android-sdk.aar file and all artifacts (.aar, .jar files, and Android support / compatibility libraries listed) listed in MapboxAndroidSDK / build.gradle. For those new to Gradle the artifacts are listed in the dependencies block. These will change over time so please check back regularly.

Legacy Support (Eclipse) - Experimental

The Mapbox Android SDK is also packaged as a .apklib file. This allows integration with older tools (Eclipse) that don't support the .aar format yet. In order to make this work the project will need to make use of Maven, and it the case of Eclipse the M2Eclipse Maven plugin. From there configure the Maven pom.xml to include the following dependency:

endency>
<groupId>com.mapbox.mapboxsdk</groupId>
<artifactId>mapbox-android-sdk</artifactId>
<version>0.5.1</version>
<type>apklib</type>
pendency>

For more information on how to use Maven and Eclipse together please see Sonatype's Developing with Eclipse and Maven tutorial.

Eclipse Hardcoding - NOT Recommended

The best way to make sure that the Mapbox Android SDK is setup properly (as well as updated as new versions are released) is to make use of Gradle or Maven as documented above. However, if that's not possible the Mapbox Android SDK can also be added to the project by hardcoding it in. Please note that this is extremely brittle and not scalable. Here's the steps:

  1. Download the mapbox-android-sdk-0.5.1.apk.
  2. Extract the source code and import it directly into the Eclipse project
  3. jar xf mapbox-android-sdk-0.5.1.apk
  4. Download all .jar dependencies from build.gradle and add to the Eclipse project as libaries. Do NOT extract the content of these files.
  5. Download all .java files from Cocoahero's GeoJSON library and add to the Eclipse project's source code.
Building From Source

Building from source means you get the very latest version of our code. The first step is to clone the repository to a directory in your system

git clone https://github.com/mapbox/mapbox-android-sdk.git

We use Gradle as a configuration and build tool: to use it with your IDE, import the project by selecting build.gradle in the project root directory as the project file.

Don't worry about installing Gradle on your system if you don't already have it: the project makes use of Gradle Wrapper, so a correct & current project version of Gradle will automatically be installed and used to run the builds. To use the Gradle wrapper just look for gradlew or gradlew.bat (Windows) in the project's main directory. For example:

cd <PROJECT_ROOT>
 ./gradlew --version

which will produce something like:

--------------------------------------------------------
le 1.10
--------------------------------------------------------

d time:   2013-12-17 09:28:15 UTC
d number: none
sion:     36ced393628875ff15575fa03d16c1349ffe8bb6

vy:       1.8.6
          Apache Ant(TM) version 1.9.2 compiled on July 8 2013
          2.2.0
          1.7.0_40 (Oracle Corporation 24.0-b56)
          Mac OS X 10.9.2 x86_64

See the Gradle Wrapper documentation for more details.

Then you can build an archive:

adlew clean assembleRelease

e archive (mapbox-android-sdk-<VERSION>.aar) will be found in
JECTHOME>/MapboxAndroidSDK/build/libs

Don't forget to then also include the dependencies from MapboxAndroidSDK / build.gradle in your classpath!

Changes from OSMDroid

This project is a fork of OSMDroid, but is significantly different as the result of major refactoring and rethinking.

Contributors Note (aka, Where's the master branch?)

The project's master branch is actually mb-pages. There is no branch named master nor will there be. The reason for it is that it allows some automatic processing and publishing of documentation behind the scenes. In practice this shouldn't affect anybody wanting to contribute, but is something that will probably seem a bit “different” to newcomers. Anyway, that's what's going on. If you'd like more information please see #404 .

Quick-start Guide

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.