1

I suddenly get this error and I don't know how to resolve this. I already tried all suggestions here Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve but nothing worked for me.

What I already tried:

  • updated my sourceCompatibility and targetCompatibility from 1.7 to JavaVersion.VERSION_1_8 as it was suggested to me
  • Deleted the .idea folder
  • deleted google-services plugin, implementation 'com.google.android.gms:play-services-auth:17.0.0' in .gradle (app) and google services class path in .gradle (project) --> error still occurs
  • When I update the google-services class path in the project file to the newest version 4.3.2 I get this error
  • deleted the google-services.json and downloaded a new one
Could not resolve com.google.gms:google-services:4.3.2.
...
Remote host closed connection during handshake
  • I invalidated Cache/restart
  • In the SDK manager the Android SDK is displayed as partially installed --> click on show Package details --> nothing to install, everything is shown as installed
  • in the misc.xml file the language level has been updated from JDK 1_7 to 1_8

Here is maybe also a problem I am facing right now which can be cause of this problem:

Previously I had the SDK 29 installed but in the SDK manager it was shown as "partially installed" but when I clicked on "Show package details" there was nothing to install. I wanted to reinstall Android 10 so I deleted it first but now I am unable to reinstall it again because it is not shown anymore in der Android SDK manager. Where can I find it again?

Under SDK Platforms there are only the installed SDKs not all SDKs I can install, is this the right behavior?

Also under "SDK Updates Sites" I get an error with the "Android Repository" under "Enabled" --> red sign with the message "IO exception while downloading manifest"

Here is the problem I currently get in Android Studio:

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-base:[17.2.0].
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-impl:[17.2.0].
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-gass:[18.2.0].
Show Details
Affected Modules: app


...

Here is my build.gradle (Project):

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.android.guessit"
        minSdkVersion 21
        targetSdkVersion 29
        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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0-alpha10'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'

    //Firebase SDKs
    implementation 'com.google.firebase:firebase-core:17.2.0'
    implementation 'com.google.firebase:firebase-auth:19.1.0'
    implementation 'com.google.firebase:firebase-analytics:17.2.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation 'com.google.firebase:firebase-ads:18.2.0'
    implementation 'com.google.firebase:firebase-perf:19.0.0'
    implementation 'com.google.firebase:firebase-messaging:20.0.0'

    implementation "androidx.lifecycle:lifecycle-extensions:2.1.0"

    //Glide maybe later add code to proguard
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

    // Circle ImageView
    implementation 'de.hdodenhof:circleimageview:3.0.1'

    // CardView and GridLayout
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.gridlayout:gridlayout:1.0.0'

    // Facebook SDK and login
    implementation 'com.facebook.android:facebook-login:4.41.0'

    //image downloading and caching library for Android
    implementation 'com.squareup.picasso:picasso:2.71828'
}

apply plugin: 'com.google.gms.google-services'   // Google Play services Gradle plugin


How can I resolve this?

Daniel Spatz
  • 77
  • 1
  • 14
  • To fix `"Also in the SDK manager the SDK 29 is displayed as partially installed although there is nothing else I can Install for this SDK".`(1) In the bottom right, click on "Show Package details" (2 )Select the packages that you require {3)Install the missing modules – Jon Goodwin Oct 06 '19 at 21:37
  • I already did this but there is nothing to install there. I already installed everything I could – Daniel Spatz Oct 06 '19 at 21:59
  • 1
    Use this to stop **java version** from being changed (*misc.xml*): `android { compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } }` Show more of `build.gradle (Project app module)` Check **java version** is up-to-date, and `PATHS` are correct. – Jon Goodwin Oct 06 '19 at 22:55
  • I updated the JavaVersion but its still not working. How do I check if the PATHS are correct? I updated my post to include my whole app gradle. Also I am using the Java version 1.8 so there it is up to date – Daniel Spatz Oct 07 '19 at 06:58
  • @JonGoodwin I updated my question with more details. I am still facing the issue – Daniel Spatz Oct 07 '19 at 09:59

2 Answers2

1

In your project build.gradle, place google() above mavenLocal() as per below:

...
allprojects {
    repositories {
        google()
        jcenter()
        mavenLocal()
        maven { url 'https://maven.fabric.io/public' }

    }
}
...
ahasbini
  • 6,761
  • 2
  • 29
  • 45
0

I just restarted my computer and it is now working as expected. Also the "IO exception" under the SDK updates sites is not displaying anymore. I think the problem was that this caused all the errors as seen in my post. I also changed the HTTP Proxy under the System Settings to "Auto-detect proxy settings". Also Kaspersky was not running in the right way so after restart it was working fine again, this could also be the solution to my described problem.

Edit:

The error has come two days after I managed to make it work again so the above mentioned solution might not be the one that helped me solving this issue. After having this problem again I tried the above steps again but nothing worked so I invalidated the cache and restarted android studio and it worked again for me.

Daniel Spatz
  • 77
  • 1
  • 14