summaryrefslogtreecommitdiff
path: root/platform/android/README.md
blob: 891fe74a533936c2d8644a6dcbe251601247657e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# [Mapbox Android SDK](https://www.mapbox.com/android-sdk/)

[![Bitrise](https://www.bitrise.io/app/79cdcbdc42de4303.svg?token=_InPF8bII6W7J6kFr-L8QQ&branch=master)](https://www.bitrise.io/app/79cdcbdc42de4303)

A library based on [Mapbox GL Native](../../README.md) for embedding interactive vector maps into Java applications on Android devices.

This repository is for day-to-day development of the SDK. Building the SDK yourself requires [a number of dependencies and steps](../../INSTALL.md) that are unnecessary for developing production applications. For production applications, please consider installing an official, prebuilt release instead; see the [Mapbox Android SDK website](https://www.mapbox.com/android-sdk/) for installation instructions.

## Installing the SDK

* [Installing the Mapbox Android SDK on Linux](INSTALL_LINUX.md)
* [Installing the Mapbox Android SDK on OS X](INSTALL_OSX.md)

## Setting up the Android emulator

The Mapbox Android SDK requires Android 4.0.3+ (API level 15+).

If you want to run the test app in the emulator, we recommend the x86 build because it will run a lot faster.

First ensure you have an `MAPBOX_ACCESS_TOKEN` environment variable set, as described below. Then, create an x86 build:

    make android-lib-x86

In Android Studio, create an x86 AVD (Android Virtual Device):

- Open AVD Manager via the Tools menu -> Android -> AVD Manager
- Click "Create Virtual Device" at the bottom on AVD Manager window
- Select one of the device profiles, for example the Nexus 4
- Click "Next"
- Select a Lollipop or Kitkat release with ABI of x86. If the line is greyed out click Download to download the OS files.
- Click "Next"
- Under "Emulated Performance" check "Host GPU" and uncheck "Store a snapshot for faster startup"
- Click "Finish"
- Close the AVD Manager

Now when you run or debug the Android project you will see a window "Choose Device". Select your new AVD from drop down under "Launch emulator". If you select "Use same device for future launches" Android Studio will remember the selection and not ask again.

## Running Mapbox GL Native on a hardware Android device

The Mapbox Android SDK requires Android 4.0.3+ (API level 15+).

First read the [Google documentation](http://developer.android.com/tools/device.html) to set up your device and your OS to connect to the device.

When you plug your device in and then run or debug the Android project you will see a window "Choose Device". Choose your device from the "Choose a running device" list.

If your device does not show up, double check the [Google documentation](http://developer.android.com/tools/device.html).