I have been trying to integrate some on new features from Mapbox into my app but gradle is. unable to resolve the. newly added dependencies.
these. are. the dependencies that are not getting resolved
implementation 'com.mapbox.maps:android:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-annotation:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-locationcomponent:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-gestures:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-compass:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-animation:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-scalebar:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-logo:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-attribution:10.0.0-rc.8'
this is my. build.gradle file app level
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.a3dmapbox"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures{
dataBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// Mapbox
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0'
implementation "com.gorisse.thomas.sceneform:sceneform:1.20.1"
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:5.6.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-building-v9:0.7.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.11.0'
implementation("com.google.android.gms:play-services-location:18.0.0")
implementation 'com.mapbox.maps:android:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-annotation:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-locationcomponent:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-gestures:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-compass:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-animation:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-scalebar:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-logo:10.0.0-rc.8'
implementation 'com.mapbox.plugin:maps-attribution:10.0.0-rc.8'
}
this is my. project. level build.gradle file
// 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 {
// 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 = project.properties['MAPBOX_DOWNLOADS_TOKEN']
}
}
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have configured the download token mapboxsdk is downloaded perfectly only the. newly added dependencies are making the issue
CodePudding user response:
They won't resolve because you are using old references, chamge them to the new sdk implementations. For example for anotations:
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0'
Reference https://docs.mapbox.com/android/plugins/guides/annotation/
CodePudding user response:
The issue here was that I was not specifying the repositories for all projects, in my build.gradle project level it should be like this
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
}
}
allprojects {
repositories {
google()
mavenCentral()
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 = project.properties['MAPBOX_DOWNLOADS_TOKEN']
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}