Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 3.5 ERROR: Unable to resolve dependency for ':app@debug/compileClasspath'

I have this errors when I try to sync gradle. I am using Android Studio 3.5 and gradle 5.4.1 . It worked fine with this configuration and suddenly I start getting this errors.

**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

this is my 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'
like image 210
ghita Avatar asked Aug 27 '19 14:08

ghita


2 Answers

If you have it declared as follows in project build.gradle

maven { url "https://jitpack.io" }

try changing to

maven { url "https://www.jitpack.io" }
like image 83
yogourt Avatar answered Nov 20 '22 12:11

yogourt


You must check your internet connection and disabled gradle offline mode in setting after that do : File > Invalidate Cache and restart. And try to sync the app !

like image 2
Issa Dicko Avatar answered Nov 20 '22 12:11

Issa Dicko