mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
475 stars 132 forks source link

Unable to resolve dependency issue #756

Closed Kashif-E closed 3 years ago

Kashif-E commented 3 years ago

I am trying to build my project but none of these dependencies are 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'

errors i am getting

Failed to resolve: com.mapbox.plugin:maps-gestures:10.0.0-rc.8 Failed to resolve: com.mapbox.plugin:maps-compass:10.0.0-rc.8 Failed to resolve: com.mapbox.plugin:maps-animation:10.0.0-rc.8 Failed to resolve: com.mapbox.plugin:maps-scalebar:10.0.0-rc.8 Failed to resolve: com.mapbox.navigation:android:2.0.0-rc.7 Failed to resolve: com.mapbox.plugin:maps-annotation:10.0.0-rc.8 Failed to resolve: com.mapbox.plugin:maps-logo:10.0.0-rc.8 Failed to resolve: com.mapbox.plugin:maps-attribution:10.0.0-rc.8 Failed to resolve: com.mapbox.plugin:maps-locationcomponent:10.0.0-rc.8 Failed to resolve: com.mapbox.navigator:mapbox-navigation-native:6.2.1 Failed to resolve: com.mapbox.maps:android:10.0.0-rc.8

this is my build.gradle (app)

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.+'
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.mapbox.mapboxsdk:mapbox-sdk-services:5.6.0'
implementation 'com.mapbox.maps:android:10.0.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.gorisse.thomas.sceneform:sceneform:1.20.1"
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

// 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 }

ank27 commented 3 years ago

@Kashif-E Can you check if you are using correct gradle configurations.
follow the guide here : https://docs.mapbox.com/android/beta/maps/guides/install/#add-the-dependency

Kashif-E commented 3 years ago

@ank27 I have updated my build.gradle files in the top comment I think. they. are correctly. configured

ank27 commented 3 years ago

@Kashif-E , from the app's build.gradle file, you are using multiple versions of maps sdk. we recommend using latest version of maps sdk v10.0.0. you can remove v9.+, 10.0.0-rc.8 and use the latest version for the dependencies.

Use something like this :

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.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// Mapbox dependency
implementation 'com.mapbox.maps:android:10.0.0'

implementation "com.gorisse.thomas.sceneform:sceneform:1.20.1"
implementation("com.google.android.gms:play-services-location:18.0.0")
}

If you are migrating from v9 to v10, use the migration guide https://docs.mapbox.com/android/beta/maps/guides/migrate-to-v10/[](https://docs.mapbox.com/android/beta/maps/guides/migrate-to-v10/)

Kashif-E commented 3 years ago

@ank27 thanks for this but it does not resolve the dependecies issue

ank27 commented 3 years ago

hmm, then probably you are not defining the repositories config for all projects. use something like this in your root build.gradle

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 = System.getenv("SDK_REGISTRY_TOKEN") ?: project.property("SDK_REGISTRY_TOKEN") as String
            }
        }
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
Kashif-E commented 3 years ago

@ank27 thanks it was the. issue indeed