I need to import import com.mapbox.maps.plugin.annotation.generated.PointAnnotationOptions;
in my app code, for that I need to implement com.mapbox.maps:android:10.2.0
in build.gradle module, but it fails.
Could someone tell me, why this gradle implement fails to resolve?
implementation ('com.mapbox.maps:android:10.2.0'){
exclude group: 'group_name', module: 'module_name'
}
This is the error msg:
Failed to resolve: com.mapbox.maps:android:10.2.0
In stack trace it says: NotFound com.mapbox.maps:android:10.2.0
Show in Project Structure dialog Affected Modules: app
build.gradle (project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication{
basic(BasicAuthentication)
}
credentials{
username='mapbox'
password= project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?:""
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
After a a few hours of research I came to find out how to properly set up Mapbox (10.0.2) on Android
IMO, this first bullet should solve the issue, otherwise keep going.
First, in settings.gradle -> as stated previously set mode to PREFERS.SETTINGS .
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
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 = MAPBOX_DOWNLOADS_TOKEN
}
}
}
}
Second, add the dependency as per usual to module-level build.gradle (not project level)
implementation 'com.mapbox.maps:android:10.2.0'
Third, this is what my project-level build.gradle looks like.
buildscript {
ext {
compose_version = '1.2.0-alpha02'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Last, in your gradle.property make sure you have
(GOOD) MAPBOX_DOWNLOADS_TOKEN = SECRET_ACCESS_CODE
(DO NOT) MAPBOX_DOWNLOADS_TOKEN = "SECRET_ACCESS_CODE"