работу с MapKit для Android

следую инструкции https://yandex.ru/dev/maps/mapkit/doc/android-quickstart/concepts/android/quickstart.html п.4 шага 2 приводит к "Build was configured to prefer settings repositories over project repositories but repository 'MavenRepo' was added by build file 'build.gradle'" Подскажите плиз что не так? ЗЫ проект пустой build.gradle проекта

plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.5.30' apply false
}

repositories {
     mavenCentral()
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle приложения (модуля).

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.example.vodkan"
        minSdk 26
        targetSdk 32
        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'
    }
}

repositories {
    maven {
        url "http://maven.google.com/"
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    // Облегчённая библиотека, содержит только карту, слой пробок,
    // LocationManager, UserLocationLayer и возможность скачивать оффлайн карты (только в платной версии).
    implementation 'com.yandex.android:maps.mobile:4.0.0-lite'
}

Ответы (2 шт):

Автор решения: Kirill DudareV

Попробуйте НЕ добавлять строчку repositories в build.gradle проекта. Вот как должны выглядеть оба файла:

build.gradle проекта


plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle приложения (модуля).

plugins {
    id 'com.android.application'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.example.nachinaetsyazdes"
        minSdk 21
        targetSdk 32
        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
    }
}

dependencies {
//У меня стоит full-версия, в вашем случае должна быть lite-версия
    implementation 'com.yandex.android:maps.mobile:4.1.0-full'
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

Не панацея, но мне помогло.

→ Ссылка
Автор решения: YaCor'

Насколько понимаю, вопрос в настройке, упомянутой в этом ответе.

settings.gradle:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
}

Если так, вам либо эту настройку отключить надо и дальше по инструкции Яндекса, либо прописывать репозиторий в самом settings.gradle.

→ Ссылка