Search code examples
android-studioandroid-gradle-pluginmapbox-androidandroid-studio-bumblebee

Mapbox dependency in Android studio Bumblebee


So as it mentioned in mapbox installation guide, in order to add dependency to top level gradle, this is what should be done:

click here to see the image.

But as you see in the picture it failed to build the gradle and it gives me that error. The structure of project level gradle is also changed to this in Android Studio Bumblebee.

How should I add Mapbox dependencies to my project?


Solution

  • Mapbox dependency should be added into settings.gradle file.

    It can be seen here.

    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            google()
            mavenCentral()
    
            //For Mapbox
            maven {
                url 'https://api.mapbox.com/downloads/v2/releases/maven'
                authentication {
                    basic(BasicAuthentication)
                }
                credentials {
                    // Do not change the username below.
                    // This should always be `mapbox` (not your username).
                    username = 'mapbox'
                    // Use the secret token you stored in gradle.properties as the password
                    password = "<your secret api key>"
                }
    
            }
        }
    }