Installation
To start developing your application using the Mapbox Java SDK, you'll need to first decide which installation method works for you. The SDK is fully compatible with Android using Gradle and can also be included in a generic Java project using either Gradle or Maven. You can find all dependencies given below on MavenCentral.
Gradle
- Start Android Studio.
- Open your project's module-level
build.gradle
file. - Make sure that your project's
minSdkVersion
is API 14 or higher. - In the dependencies block, add a new
implementation
dependency for each Java SDK package you want in your project, as shown below. - Click
Sync Project with Gradle Files
near the toolbar in Android Studio.
repositories {
google()
}
dependencies {
// Replace `DESIRED_JAVA_SDK_PACKAGE` with the name of an available package:
// https://docs.mapbox.com/android/java/guides/#available-packages
implementation 'com.mapbox.mapboxsdk:DESIRED_JAVA_SDK_PACKAGE:7.3.0'
implementation 'androidx.annotation:annotation:1.0.0'
}
Android's 64K method count limit
If your project is close or exceeds the 64K method count limit, you can mitigate this problem by selectively compiling only the specific Mapbox Android Service APIs you are using in your project.
Maven
If your project is using Maven instead of Gradle, you can add the dependency inside your project's POM.xml
file, as shown below.
<dependency>
<groupId>com.mapbox.mapboxsdk</groupId>
{/* Replace `DESIRED_JAVA_SDK_PACKAGE` with the name of an available package:
https://docs.mapbox.com/android/java/guides/#available-packages */}
<artifactId>DESIRED_JAVA_SDK_PACKAGE</artifactId>
<version>7.3.0</version>
</dependency>
この{Type}は役に立ちましたか?