在 Gradle 中处理调试资源时获取 CircularReferenceException

问题描述 投票:0回答:1

在Android Studio中构建项目时遇到CircularReferenceException,不确定是否与Gradle或依赖项有关。

以下任务之间的循环依赖: :应用程序:进程调试资源 --- :app:processDebugResources (*)

例外是:- org.gradle.api.CircularReferenceException:以下任务之间的循环依赖关系: :app:process调试资源 --- :app:processDebugResources (*)

这是我的 AndroidManifest.xml 文件:-

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.E_commerce_Application"
        tools:targetApi="31">
        <activity
            android:name=".orderConfirmation"
            android:exported="false" />
        <activity
            android:name=".BILLInfo"
            android:exported="false" />
        <activity
            android:name=".payment"
            android:exported="false" />
        <activity
            android:name=".art"
            android:exported="false" />
        <activity
            android:name=".toys"
            android:exported="false" />
        <activity
            android:name=".skincare"
            android:exported="false" />
        <activity
            android:name=".kitchenware"
            android:exported="false" />
        <activity
            android:name=".clothes"
            android:exported="false" />
        <activity
            android:name=".food"
            android:exported="false" />
        <activity
            android:name=".HomePage"
            android:exported="false" />
        <activity
            android:name=".SignUp"
            android:exported="false" />
        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

这是我的 build.gradle.kts(:app) :-

plugins {
    id("com.android.application")
    id("com.google.gms.google-services")
}

android {
    namespace = "com.example.e_commerce_application"
    compileSdk = 34

    defaultConfig {
        applicationId = "com.example.e_commerce_application"
        minSdk = 24
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"

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


    buildFeatures{
        dataBinding = true
        viewBinding = true
    }
    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation("androidx.appcompat:appcompat:1.6.1")
    implementation("com.google.android.material:material:1.11.0")
    implementation("androidx.constraintlayout:constraintlayout:2.1.4")
    implementation("com.google.firebase:firebase-auth:22.3.1")
    implementation("com.google.firebase:firebase-database:20.3.1")
    implementation(project(":app"))

    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.1.5")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
    // Import the BoM for the Firebase platform
    implementation(platform("com.google.firebase:firebase-bom:32.8.0"))
    implementation("com.google.firebase:firebase-database")
//    implementation("androidx.cardview:cardview:1.0.0")

}```

I tired changing the version of buildtools.I refered this youtube tutorial(https://youtu.be/UcxkuImuju8?si=_VynoO5IkS-BISwg) . 
android exception gradle build.gradle circular-dependency
1个回答
0
投票

您的

build.gradle
dependencies
块中的以下行:

implementation(project(":app"))

会产生循环依赖。

© www.soinside.com 2019 - 2024. All rights reserved.