1

I am getting this error for my multimodule android app when I run gradle clean build

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:checkDebugLibraries'.
> Could not resolve all dependencies for configuration ':app:debugReverseMetadataValues'.
   > Could not resolve project :payment.
     Required by:
         project :app
      > No matching variant of project :payment was found. The consumer was configured to find a component for use during 'android-reverse-meta-data', as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.8.1', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' but:
          - Variant 'debugApiElements' declares a component, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.8.1', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug':
              - Incompatible because this component declares a component for use during compile-time and the consumer needed a component for use during 'android-reverse-meta-data'        
          - Variant 'debugRuntimeElements' declares a component, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.8.1', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug':
              - Incompatible because this component declares a component for use during runtime and the consumer needed a component for use during 'android-reverse-meta-data'
          - Variant 'releaseApiElements' declares a component, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.8.1':
              - Incompatible because this component declares a component for use during compile-time, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component for use during 'android-reverse-meta-data', as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'
          - Variant 'releaseRuntimeElements' declares a component, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.8.1':
              - Incompatible because this component declares a component for use during runtime, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component for use during 'android-reverse-meta-data', as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'

This is the structure of my application:

|--app
|--payment

The build file details:

Build.gradle.kts(:payment)

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.android)
    alias(libs.plugins.kotlin.compose)
}

android {
    namespace = "com.stream.payment"
    compileSdk = 35

    defaultConfig {
        minSdk = 28
        targetSdk = 35

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

    buildTypes {
        release {
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_21
        targetCompatibility = JavaVersion.VERSION_21
    }
    kotlinOptions {
        jvmTarget = "21"
    }
    buildFeatures {
        compose = true
        aidl = false
        buildConfig = false
        renderScript = false
        shaders = false
    }
}

dependencies {

    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.lifecycle.runtime.ktx)
    implementation(libs.androidx.activity.compose)
    implementation(platform(libs.androidx.compose.bom))
    implementation(libs.androidx.ui)
    implementation(libs.androidx.ui.graphics)
    implementation(libs.androidx.ui.tooling.preview)
    implementation(libs.androidx.material3)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
    androidTestImplementation(platform(libs.androidx.compose.bom))
    androidTestImplementation(libs.androidx.ui.test.junit4)
    debugImplementation(libs.androidx.ui.tooling)
    debugImplementation(libs.androidx.ui.test.manifest)
}

build.gradle.kts(:app)

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
id("com.google.devtools.ksp") version "2.1.0-1.0.29"
}

android {
namespace = "com.stream.myapp"
compileSdk = 35

    defaultConfig {
        applicationId = "com.stream.myapp"
        minSdk = 27
        targetSdk = 35
        versionCode = 1
        versionName = "1.0"
    
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }
    
    buildTypes {
        release {
            isMinifyEnabled = true
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_21
        targetCompatibility = JavaVersion.VERSION_21
    }
    kotlinOptions {
        jvmTarget = "21"
    }
    buildFeatures {
        compose = true
    }
    packaging {
        resources {
            excludes += "/META-INF/{AL2.0,LGPL2.1}"
        }
    }
    dynamicFeatures.addAll(listOf(":payment"))

}

dependencies {

    implementation(libs.androidx.navigation.compose)
    
    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.lifecycle.runtime.ktx)
    implementation(libs.androidx.activity.compose)
    implementation(platform(libs.androidx.compose.bom))
    implementation(libs.androidx.ui)
    implementation(libs.androidx.ui.graphics)
    implementation(libs.androidx.ui.tooling.preview)
    implementation(libs.androidx.material3)
    implementation (libs.androidx.material.icons.extended)
    
    testImplementation(libs.junit)
    
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
    androidTestImplementation(platform(libs.androidx.compose.bom))
    androidTestImplementation(libs.androidx.ui.test.junit4)
    androidTestImplementation(libs.androidx.navigation.testing)
    
    
    debugImplementation(libs.androidx.ui.tooling)
    debugImplementation(libs.androidx.ui.test.manifest)
    
    //Room
    implementation(libs.androidx.room.runtime)
    ksp(libs.androidx.room.compiler)
    implementation(libs.androidx.room.ktx)
    
    implementation(project(path = ":payment", configuration = "default"))

}

settings.gradle.kts(My App)

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()
}
}

rootProject.name = "My App"
include(":app")
include(":payment")

I followed these android documentation for implementing the multi module but it didn't work: https://developer.android.com/guide/navigation/integrations/multi-module

https://medium.com/androiddevelopers/patterns-for-accessing-code-from-dynamic-feature-modules-7e5dca6f9123

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.