javaandroidkotlingradle

Unable to resolve - Could not resolve all files for configuration ':app:debugRuntimeClasspath'


I've been encountering this issue for a while now. I've tried various solutions, such as toggling between offline and online modes in Gradle, adding
maven { url = uri("https://jitpack.io") } in the project build.gradle, and more, but I still can't resolve the error.

Note: My project is primarily in Java, but I recently added Kotlin code due to the requirements of the Supabase Database SDK. That's why you may encounter Kotlin and Groovy in the project

Error:

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

Project build.gradle:

buildscript {
    ext.kotlin_version = '1.9.0'
    repositories {
        google()
        maven { url = uri("https://jitpack.io") }
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath libs.google.services
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

plugins {
    alias(libs.plugins.androidApplication) apply false
}

App build.gradle:

plugins {
    alias(libs.plugins.androidApplication)
    id 'com.google.gms.google-services'
    id 'kotlin-android'
}

android {
    namespace 'com.indiedev91.looksmaxeai_bebetterversion'
    compileSdk 35

    defaultConfig {
        applicationId "com.indiedev91.looksmaxeai_bebetterversion"
        minSdk 24
        targetSdk 35
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        debug {
            buildConfigField "String", "API_KEY", "\"your_production_api_key\""
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            buildConfigField "String", "API_KEY", "\"your_production_api_key\""
        }
    }

    buildFeatures {
        buildConfig = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = "17"
    }

    java {
        toolchain {
            languageVersion = JavaLanguageVersion.of(17)
        }
    }
}

dependencies {
    implementation libs.appcompat
    implementation libs.material
    implementation libs.activity
    implementation libs.constraintlayout
    implementation libs.firebase.auth
    implementation libs.firebase.firestore
    implementation libs.firebase.crashlytics.buildtools
    implementation libs.firebase.storage
    testImplementation libs.junit
    androidTestImplementation libs.ext.junit
    androidTestImplementation libs.espresso.core

    def camerax_version = "1.3.0"
    implementation libs.camera.core
    implementation libs.camera.camera2
    implementation libs.camera.lifecycle
    implementation libs.camera.view
    implementation libs.concurrent.futures.ktx
    implementation libs.guava
    // Loading animations
    implementation 'com.github.ybq:Android-SpinKit:1.4.0'

    // Circle Image View
    implementation libs.circleimageview

    implementation libs.work.runtime

    //Google Credential Manager
    implementation libs.credentials
    implementation libs.credentials.play.services.auth.v150beta01
    implementation libs.googleid.v111

    implementation libs.core.ktx
    implementation libs.kotlin.stdlib
    implementation(libs.bom)
    implementation("io.github.jan-tennert.supabase:postgrest-kt")
    implementation("io.github.jan-tennert.supabase:gotrue-kt")
    implementation("io.ktor:ktor-client-android:3.0.1")



}

settings.gradle:

pluginManagement {
    repositories {
        google {
            content {
                includeGroupByRegex("com\\.android.*")
                includeGroupByRegex("com\\.google.*")
                includeGroupByRegex("androidx.*")
            }
        }
  
        mavenCentral()
        gradlePluginPortal()
    }
}

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url "https://jitpack.io" }
        jcenter() // Warning: this repository is going to shut down soon
    }
}

rootProject.name = "LooksMaxE AI - Be Better Version"
include ':app'

Update:- As requested im sharing the libs.versions.toml file

libs.versions.toml

[versions]
agp = "8.3.0"
bom = "3.0.1"
cameraCore = "1.3.0"
circleimageview = "3.1.0"
concurrentFuturesKtx = "1.2.0"
coreKtx = "1.15.0"
credentials = "1.5.0-beta01"
credentialsPlayServicesAuth = "1.3.0"
credentialsPlayServicesAuthVersion = "1.5.0-beta01"
emojislider = "0.3.2"
googleid = "1.3.0"
googleidVersion = "1.1.1"
guava = "29.0-android"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
appcompat = "1.7.0"
kotlinStdlib = "2.0.21"
material = "1.12.0"
activity = "1.8.0"
constraintlayout = "2.1.4"
googleServices = "4.4.2"
firebaseAuth = "23.1.0"
firebaseFirestore = "25.1.1"
firebaseCrashlyticsBuildtools = "3.0.2"
firebaseStorage = "21.0.1"
workRuntime = "2.10.0"

[libraries]
bom = { module = "io.github.jan-tennert.supabase:bom", version.ref = "bom" }
camera-camera2 = { module = "androidx.camera:camera-camera2", version.ref = "cameraCore" }
camera-core = { module = "androidx.camera:camera-core", version.ref = "cameraCore" }
camera-lifecycle = { module = "androidx.camera:camera-lifecycle", version.ref = "cameraCore" }
camera-view = { module = "androidx.camera:camera-view", version.ref = "cameraCore" }
circleimageview = { module = "de.hdodenhof:circleimageview", version.ref = "circleimageview" }
concurrent-futures-ktx = { module = "androidx.concurrent:concurrent-futures-ktx", version.ref = "concurrentFuturesKtx" }
core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
credentials = { module = "androidx.credentials:credentials", version.ref = "credentials" }
credentials-play-services-auth = { module = "androidx.credentials:credentials-play-services-auth", version.ref = "credentialsPlayServicesAuth" }
credentials-play-services-auth-v150beta01 = { module = "androidx.credentials:credentials-play-services-auth", version.ref = "credentialsPlayServicesAuthVersion" }
emojislider = { module = "com.bernaferrari.emojislider:emojislider", version.ref = "emojislider" }
googleid = { module = "com.google.android.libraries.identity.googleid:googleid", version.ref = "googleid" }
googleid-v111 = { module = "com.google.android.libraries.identity.googleid:googleid", version.ref = "googleidVersion" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlinStdlib" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
google-services = { group = "com.google.gms", name = "google-services", version.ref = "googleServices" }
firebase-auth = { group = "com.google.firebase", name = "firebase-auth", version.ref = "firebaseAuth" }
firebase-firestore = { group = "com.google.firebase", name = "firebase-firestore", version.ref = "firebaseFirestore" }
firebase-crashlytics-buildtools = { group = "com.google.firebase", name = "firebase-crashlytics-buildtools", version.ref = "firebaseCrashlyticsBuildtools" }
firebase-storage = { group = "com.google.firebase", name = "firebase-storage", version.ref = "firebaseStorage" }
work-runtime = { module = "androidx.work:work-runtime", version.ref = "workRuntime" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }

Solution

  • I see two main issues with your build files:

    1. The Supabase BOM needs to be implemented as platform. Replace

      implementation(libs.bom)
      

      with

      implementation(platform(libs.bom))
      

      You might also want to consider renaming bom to supabase-bom or something along the lines. There are many BOMs out there. This one is the BOM for Supabase.

    2. io.github.jan-tennert.supabase:gotrue-kt doesn't exist. From the project page:

      Warning This repository is archived. Use supabase-kt instead to use Supabase in your Kotlin projects.

      Since you use postgrest-kt which already transitively uses supabase-kt you can simply remove this line:

      implementation("io.github.jan-tennert.supabase:gotrue-kt")