Circular dependency between the following tasks: :app:processDebugResources \--- :app:processDebugResources (*)

Hello Experts,

I am new to Android development & Gradle.

I was working on Android Studio project & had this error

Circular dependency between the following tasks:
:app:processDebugResources
\--- :app:processDebugResources (*)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 569ms

When Running with --debug option

Circular dependency between the following tasks:
:app:processDebugResources
\--- :app:processDebugResources (*)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 1s
Build operation 'Build finished for file system watching' started
Completing Build operation 'Build finished for file system watching'
Build operation 'Build finished for file system watching' completed
Releasing file lock for cache directory md-supplier (/home/srj/.gradle/caches/8.4/md-supplier)
Releasing lock on cache directory md-supplier (/home/srj/.gradle/caches/8.4/md-supplier).
Releasing file lock for Build Output Cleanup Cache (/home/srj/AndroidStudioProjects/MyTCPpro/.gradle/buildOutputCleanup)
Releasing lock on Build Output Cleanup Cache (/home/srj/AndroidStudioProjects/MyTCPpro/.gradle/buildOutputCleanup).
Releasing file lock for cache directory md-rule (/home/srj/.gradle/caches/8.4/md-rule)
Releasing lock on cache directory md-rule (/home/srj/.gradle/caches/8.4/md-rule).
Resolution result cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs)
Resolution result cache closed. Cache reads: 4, disk reads: 1 (avg: 0.005 secs, total: 0.005 secs)
Deleted 2 resolution results binary files in 0.0 secs
Completing Build operation 'Run build'
Build operation 'Run build' completed
Daemon worker Thread 6: released lock on worker lease
Stopping 0 deployment handles
Stopped deployment handles
VCS Checkout Cache (/home/srj/AndroidStudioProjects/MyTCPpro/.gradle/vcs-1) has last been fully cleaned up 23 hours ago
Cache VCS Checkout Cache (/home/srj/AndroidStudioProjects/MyTCPpro/.gradle/vcs-1) was closed 0 times.
Cache VCS metadata (/home/srj/AndroidStudioProjects/MyTCPpro/.gradle/8.4/vcsMetadata) was closed 0 times.
Releasing file lock for checksums cache (/home/srj/AndroidStudioProjects/MyTCPpro/.gradle/8.4/checksums)
Releasing lock on checksums cache (/home/srj/AndroidStudioProjects/MyTCPpro/.gradle/8.4/checksums).
Releasing file lock for file hash cache (/home/srj/AndroidStudioProjects/MyTCPpro/.gradle/8.4/fileHashes)
Releasing lock on file hash cache (/home/srj/AndroidStudioProjects/MyTCPpro/.gradle/8.4/fileHashes).
Releasing file lock for dependencies-accessors (/home/srj/AndroidStudioProjects/MyTCPpro/.gradle/8.4/dependencies-accessors)
Releasing lock on dependencies-accessors (/home/srj/AndroidStudioProjects/MyTCPpro/.gradle/8.4/dependencies-accessors).
dependencies-accessors (/home/srj/AndroidStudioProjects/MyTCPpro/.gradle/8.4/dependencies-accessors) has last been fully cleaned up 23 hours ago
The daemon has finished executing the build.

My build.gradle app module

plugins {
    alias(libs.plugins.androidApplication)
    alias(libs.plugins.jetbrainsKotlinAndroid)
}

android {
    namespace = "com.srj.mytcppro"
    compileSdk = 34

    defaultConfig {
        applicationId = "com.srj.mytcppro"
        minSdk = 26
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = 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"
    }
    buildFeatures {
        viewBinding = true
    }
}

dependencies {

    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.appcompat)
    implementation(libs.material)
    implementation(libs.androidx.constraintlayout)
    implementation(libs.androidx.lifecycle.livedata.ktx)
    implementation(libs.androidx.lifecycle.viewmodel.ktx)
    implementation(libs.androidx.navigation.fragment.ktx)
    implementation(libs.androidx.navigation.ui.ktx)
    implementation(project(":app"))
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
    implementation("androidx.appcompat:appcompat:1.3.1")
    implementation("com.google.android.material:material:1.4.0")
    implementation("androidx.databinding:databinding-runtime:7.0.2")


}

After Searching on Webs I found this:

Circular dependencies can occur when one task depends on another, and vice versa, creating a loop in the dependency graph.

Can someone help me with this?
How can I find which depencies might cause these issues.

How to solve this?

Thanks & Regards!!!

–SRJ

You depend on yourself with implementation(project(":app"))

Thanks for your valuable reply.

I tried removing that line & my issue is solved now…

1 Like