web-dev-qa-db-fra.com

Android Studio 3.5 ERREUR: impossible de résoudre la dépendance pour ': app @ debug / compileClasspath'

J'ai ces erreurs lorsque j'essaie de synchroniser Gradle. J'utilise Android Studio 3.5 et gradle 5.4.1. Cela a bien fonctionné avec cette configuration et tout à coup, je commence à obtenir ces erreurs.

**ERROR**: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.Android.gms:play-services-location:[15.0.0, 16.0.0).
Affected Modules: app

**ERROR**: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.google.Android.gms:play-services-location:[15.0.0, 16.0.0).
Affected Modules: app

**ERROR**: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.google.firebase:firebase-messaging:[10.2.1, 12.1.0).
Affected Modules: app

**ERROR**: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.google.Android.gms:play-services-location:[10.2.1, 12.1.0).
Affected Modules: app

c'est mon app/build.gradle:

apply plugin: 'com.Android.application'
apply plugin: 'kotlin-Android'
apply plugin: 'kotlin-Android-extensions'
apply plugin: "androidx.navigation.safeargs"
apply plugin: 'com.apollographql.Android'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'io.fabric'

def versionMajor = 4
def versionMinor = 0
def versionPatch = 0
def versionBuild = 345

def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

Android {
    signingConfigs {
        config {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    compileSdkVersion 29
    defaultConfig {
        applicationId "example"
        minSdkVersion 26
        targetSdkVersion 29
        versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
        versionName "${versionMajor}.${versionMinor}.${versionPatch}.${versionBuild}"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = [auth0Domain: "@string/com_auth0_domain", auth0Scheme: "demo"]
        setArchivesBaseName new Date().format("dd.MMM.yy") + "-v#" + versionName

        //OneSignal
        manifestPlaceholders = [
                onesignal_app_id: 'id',
                // Project number pulled from dashboard, local value is ignored.
                onesignal_google_project_number: 'REMOTE'
        ]

        // add some strings to res
        resValue('string', 'google_maps_api_key', google_maps_api_token)
        resValue('string', 'google_maps_places_api_key', google_maps_places_api_token)
        buildConfigField("String", "API_TOKEN", "\"$api_token\"")
        buildConfigField("String", "ADJUST_TOKEN", "\"$adjust_token\"")
        buildConfigField("String", "GRAPH_QL", "\"$api_graphql\"")

        renderscriptTargetApi 28
        renderscriptSupportModeEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            debuggable false
            proguardFiles getDefaultProguardFile('proguard-Android.txt'), 'proguard-rules.pro'
            buildConfigField("String", "SERVER_URL", "\"$api_base_url$api_ext_release\"")
            signingConfig signingConfigs.config
        }
        staging {
            debuggable true
            applicationIdSuffix ".staging"
            buildConfigField("String", "SERVER_URL", "\"$api_base_url$api_ext_staging\"")
            signingConfig signingConfigs.config
        }
        debug {
            debuggable true
            applicationIdSuffix ".debug"
            buildConfigField("String", "SERVER_URL", "\"$api_base_url$api_ext_dev\"")
            signingConfig signingConfigs.config
        }
    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

apollo {
    customTypeMapping = ["Datetime": "Java.lang.String"]
    customTypeMapping = ["Currency": "Java.lang.String"]
    useSemanticNaming = false
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    // Android ui and support versions
    implementation(
            "androidx.appcompat:appcompat:$appcompat_version",
            "androidx.constraintlayout:constraintlayout:$constraintlayout_version",
            "com.google.Android.material:material:$material_design_components_version"
    )

    compileOnly group: "javax.annotation", name: "javax.annotation-api", version: "1.3.2"
    compileOnly group: "org.jetbrains", name: "annotations", version: "13.0"

    implementation(
            "androidx.core:core-ktx:$ktx_version",
            "androidx.fragment:fragment-ktx:$ktx_version",
            "Android.Arch.navigation:navigation-fragment-ktx:$nav_version",
            "Android.Arch.navigation:navigation-ui-ktx:$nav_version"
    )
    implementation "Android.Arch.navigation:navigation-fragment:$nav_version"
    // use -ktx for Kotlin
    implementation "Android.Arch.navigation:navigation-ui:$nav_version"
    // use -ktx for Kotlin
    implementation(
            "com.mikepenz:fastadapter:$fast_adapter_version",
            "com.mikepenz:fastadapter-commons:$fast_adapter_version",
            "com.mikepenz:fastadapter-extensions-expandable:$fast_adapter_version",
            "com.mikepenz:fastadapter-extensions:$fast_adapter_version",
            "com.mikepenz:materialize:$materialize_version"
    )

    // firebase
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'

    // data and api
    implementation(
            "com.apollographql.apollo:apollo-runtime:$apollo_version",
            "com.apollographql.apollo:apollo-http-cache:$apollo_version"
    )
    implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_interceptor_version"
    // rx
    implementation(
            "io.reactivex.rxjava2:rxandroid:$rx_Android_version",
            "io.reactivex.rxjava2:rxjava:$rx_Java_version",
            "com.apollographql.apollo:apollo-rx2-support:$apollo_version"

    )

    implementation "de.hdodenhof:circleimageview:$circle_imageview_version"

    // koin di
    implementation(
            "org.koin:koin-Android:$koin_version",
            "org.koin:koin-androidx-scope:$koin_version",
            "org.koin:koin-androidx-viewmodel:$koin_version"
    )
    // rx Android networking
    implementation(
            "com.amitshekhar.Android:rx2-Android-networking:$afn_version",
            "com.github.prashantsolanki3:Secure-Pref-Manager:$secure_prefs_vresion"
    )

    //Beta by Crashlytics
    compile('com.crashlytics.sdk.Android:crashlytics:2.10.1@aar') {
        transitive = true;
    }

    implementation 'com.jakewharton.timber:timber:4.7.1'

    implementation "com.google.maps.Android:android-maps-utils:0.5"
    implementation 'com.google.Android.gms:play-services-maps:17.0.0'
    implementation 'com.google.Android.gms:play-services-location:17.0.0'
    implementation 'com.google.Android.gms:play-services-places:17.0.0'
    implementation 'com.google.Android.libraries.places:places:1.1.0'

    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    testImplementation "junit:junit:$junit_version"
    androidTestImplementation("androidx.test:runner:$test_runner_version",
            "androidx.test.espresso:espresso-core:$espresso_test_version"
    )

    //Glide
    implementation "com.github.bumptech.glide:glide:$glide_version"
    annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"

    //Permission Manager
    implementation 'com.github.florent37:runtime-permission-kotlin:1.1.0'

    //Notification banner
    implementation 'com.github.shasin89:NotificationBanner:1.1.0'

    //Loading spinner
    implementation 'com.github.ybq:Android-SpinKit:1.2.0'

    //Circle image view
    implementation 'de.hdodenhof:circleimageview:3.0.0'

    //helpers for Android SDK
    implementation "org.jetbrains.anko:anko:$anko_version"

    //date helper
    implementation 'com.jakewharton.threetenabp:threetenabp:1.1.0'

    //Picasso
    implementation 'com.squareup.picasso:picasso:2.71828'

    //EventBus
    implementation 'org.greenrobot:eventbus:3.1.1'

    //Round corner progress bar
    implementation 'com.akexorcist:RoundCornerProgressBar:2.0.3'

    //Expandable RecycleView
    implementation 'com.thoughtbot:expandablerecyclerview:1.3'

    //OneSignal
    implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'

    implementation "joda-time:joda-time:$jodatime_version"

    implementation 'com.github.drawers:SpinnerDatePicker:2.0.1'

    //Adjust
    implementation 'com.adjust.sdk:adjust-Android:4.18.0'
    implementation 'com.Android.installreferrer:installreferrer:1.0'
//    implementation 'com.adjust.sdk:adjust-Android-webbridge:4.18.0' if user Adjust with webview

    testImplementation 'org.koin:koin-test:1.0.1'
    debugImplementation 'com.readystatesoftware.chuck:library:1.1.0'
    stagingImplementation 'com.readystatesoftware.chuck:library:1.1.0'
    releaseImplementation 'com.readystatesoftware.chuck:library-no-op:1.1.0'
}

apply plugin: 'com.google.gms.google-services'
7
ghita

Vous devez vérifier votre connexion Internet et désactiver le mode hors ligne gradle dans le réglage après cela: Fichier> Invalider le cache et redémarrer. Et essayez de synchroniser l'application!

0
Issa Dicko