0

I'm trying to list my project's libraries to see nested dependencies while trying to solve a dependency clash/collision issue and I'm getting this error which you can see in the screenshot.

I tried some things which I saw on the internet but none of them seemed to change a thing.

So basically when I run ./gradlew app:dependencies

I get:

"Could not resolve all files for configuration ':classpath'."

Gradle is a powerful tool but honestly I cannot wrap around my head its directory structure, its dozens of setting files, its fastly evolving new versions and its complex hierarchy and dependency system which nests inside Android development interconnected with Java, Android Studio and as well with my project.

It was always a "Well they say I should add this line, let's see if it helps or not" thing for me. It is like a magical perpetual motion machine when it works as long as it doesn't, without changing the slightest thing in my project.

Please help if you can.

enter image description here

Contents of build.gradle file:

plugins {
    id 'com.android.application' version '7.4.0' apply false
    id 'com.android.library' version '7.4.0' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.20-Beta' apply false
}

Contents of build.gradle file which magically has the same f. name:

//module/app level

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

android {
    namespace 'com.myapp.package.here'
    compileSdk 33

    buildFeatures{
        viewBinding true
    }

    defaultConfig {
        applicationId "com.myapp.package.here"
        minSdk 24
        targetSdk 33
        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'
    }
}

dependencies {

    implementation 'com.google.android.material:material:1.8.0'
    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.0.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    testImplementation 'junit:junit:4.13.2'
}
Adam Varhegyi
  • 11,307
  • 33
  • 124
  • 222

1 Answers1

0

The classpath configuration is the configuration for the build script (build environment) itself, see the docs for more details. The issue you are facing is explained in the error you have provided:

No matching variant of com.android.tools.build:gradle:7.4.0 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5'

and so on. The concept of variants is explained in understanding variant selection. Breaking down, it seems the main issue is:

  • The com.android.application 7.4 requires Java 11, but you have configured Java 8. Possible this answer may help you.
Cisco
  • 20,972
  • 5
  • 38
  • 60