
You can use the Manifest merge feature to reduce the need to include any SDK requirements in your application's manifest file. If you ever need to rotate your access token, you will need to update the token value in your R.strings.xml file. If you would like to manage your public access token this way, open your project's R.strings.xml file and add the following string resource, replacing YOUR_MAPBOX_ACCESS_TOKEN with your public Mapbox API token: YOUR_MAPBOX_ACCESS_TOKEN Many of the examples and code snippets on this site assume your token is stored in a file in your project with other string values. There are many ways to configure your public access token.
MAPBOX_DOWNLOADS_TOKEN=YOUR_SECRET_MAPBOX_ACCESS_TOKEN
Add your secret token your gradle.properties file:. You can read more about Gradle properties in the official Gradle documentation. Once you have found or created the file, its path should be «USER_HOME»/.gradle/gradle.properties. The folder can be found at «USER_HOME»/.gradle. Find or create a gradle.properties file in your Gradle user home folder. To avoid exposing your secret token, add it as an environment variable: Once this configuration step has been completed, you will be able to reference your credentials in other parts of your app. Instead, you should store them somewhere safe on your computer and take advantage of Gradle properties to make sure they're only added when your app is compiled. You should not expose these access tokens in publicly-accessible source code where unauthorized users might find them. The token you've created is a secret token, which means you will only have one opportunity to copy it somewhere secure. Click the Create token button at the bottom of the page to create your token. From the token creation page, give your token a name and make sure the box next to the Downloads:Read scope is checked.
From your account's tokens page, click the Create a token button. A secret access token with the Downloads:Read scope. A public access token: From your account's tokens page, you can either copy your default public token or click the Create a token button to create a new public token. If you don't have a Mapbox account: sign up and navigate to your Account page. The SDK requires two pieces of sensitive information from your Mapbox account. Configure credentialsīefore installing the SDK, you will need to gather the appropriate credentials. If those steps do not lower your method count below 64K, you can also enable multidex. Android's 64K method count limitIf your application is over the 64K method limit, you can shrink, obfuscate, and optimize your code with R8 or ProGuard.