2

Connecting module application and get following error:

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

Module structure

/app
|--base
|--authfire

Error appears after adding to authfire gradle this line api project(path: ':app')

What I actually need is simply use MainActivity class from root app inside authfire for starting MainActivity. Woud be appreciate for any help.

:app gradle

    apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-kapt'

apply from: '../dependencies.gradle'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.alazar.tracker"
        minSdkVersion 22
        targetSdkVersion 30
        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 1.8
        targetCompatibility 1.8
    }

    buildFeatures {
        viewBinding = true
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])

    implementation project(path: ':app:base')
    implementation project(path: ':app:authfire')

    implementation libs.kotlin
    implementation libs.core
    implementation libs.appcompat
    implementation libs.lifecycle
    implementation libs.constraint
    implementation libs.material
    testImplementation libs.testJunit
    androidTestImplementation libs.androidTestJunit
    androidTestImplementation libs.androidTestEspresso

    // dagger
    implementation libs.dagger
    kapt libs.daggerKapt

}

:app:authfire gradle

    plugins {
    id 'com.android.library'
    id 'kotlin-android'
    id 'com.google.gms.google-services'
    id 'kotlin-kapt'
}

apply from: '../../dependencies.gradle'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        minSdkVersion 22
        targetSdkVersion 30
        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'
    }

    buildFeatures {
        viewBinding = true
    }
}

dependencies {
    //noinspection GradleDependency
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.72" // because of Firebase compatibility
}

dependencies {
    api project(path: ':app')
    api project(path: ':app:base')

    implementation libs.core
    implementation libs.appcompat
    implementation libs.material
    implementation libs.constraint
    implementation libs.lifecycle

    testImplementation libs.testJunit
    androidTestImplementation libs.androidTestJunit
    androidTestImplementation libs.androidTestEspresso

    // Firebase
    implementation platform('com.google.firebase:firebase-bom:26.0.0')
    implementation 'com.google.firebase:firebase-auth-ktx:20.0.0'
    implementation 'com.google.firebase:firebase-firestore-ktx:22.0.0'

    // RX
    implementation libs.rxKotlin

    // dagger
    implementation libs.dagger
    kapt libs.daggerKapt

}

Thanks!

white-imp
  • 313
  • 2
  • 16

2 Answers2

2

Move the common/shared code used by the two modules to another module, say common: we have,

common module

module 1 depends on common

module 2 depends on common

and so on.. this way you won't have a circular dependency issue

Samurai
  • 21
  • 3
0

App is depending on authfire

authfire is depending on App

That for sure make a loop.

it seems that in project: authfire you need to use some parameters from project: App. Solution whould be like this:

App is depending on authfire (that is ok)

App is passing parameters to Project:authfire (that would be ok) (example of passing parameters is using broadcast)