Search code examples
androidgradletomtomtomtom-android-sdk

Gradle error - Failed to resolve adding TomTom Maps SDK in Android Studio


I want to calculate distance between 2 points and show the distance and duration in a textview. For that I am using TomTom's Rounting API. When I am trying to add the dependancy to my project, my gradle is throwing the following error - ERROR: Failed to resolve: com.tomtom.online:sdk-routing:2.4101 Show in Project Structure dialog Affected Modules: app

I have followed all the steps mentioned in the TomTom Documentation - https://developer.tomtom.com/maps-android-sdk/getting-started-2

These are the code changes that I have made -

Added compileOptions in the app build.gradle file -


android {
    compileSdkVersion 28
    defaultConfig {
        resConfigs "en"
        applicationId "com.example.practiseRouting"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.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
    }
}

Added dependencies as well

implementation 'com.tomtom.online:sdk-routing:2.4101'

Added the API Key in Manifest file -

<meta-data
                android:name="OnlineRouting.Key"
                android:value="--------------------------------" />

I have a stable internet connection so that should not be an issue. Any help in resolving this issue will be highly appreciated.

Thanks in advance.


Solution

  • https://developer.tomtom.com/maps-sdk-android/android-tutorials-use-cases/search-along-route

    In the build.gradle project file, add the TomTom repository to the list of repositories. The TomTom Maps SDK dependencies are downloaded from there.

    allprojects {
        repositories {
            google()
            jcenter()
            maven {
                url "https://maven.tomtom.com:8443/nexus/content/repositories/releases/"
            }
        }
    }