I have an Android application which depends on another module constantly being developed in an Azure repository. So I have these lines in .gitmodules file:
[submodule "MyModuleLibrary"]
path = MyModuleLibrary
url = https://minem@dev.azure.com/minem/minem%20CMS/_git/MyModuleLibrary
branch = mytest
in settings.gradle, I have:
include ':mymodule'
project(':mymodule').projectDir = new File(rootDir, 'MyModuleLibrary/mymodulelibrary/')
in app-level build.gradle I have:
dependencies {
implementation project(':mymodule') ...
Now regardless of what build variant I choose (I chose dev), when I build the project, I get this error:
Could not resolve all task dependencies for configuration ':app:productionDebugCompileClasspath'.
Could not resolve project :mymodule.
Required by:
project :app
No matching configuration of project :mymodule was found. The consumer was configured to find a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.ProductFlavor:environment' with value 'production', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.3.0', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
None of the consumable configurations have attributes.
I'm using this version of gradle (Project-level build.gradle):
classpath 'com.android.tools.build:gradle:8.3.0'
And in gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
After 3 weeks of horror, I ran this command in the root folder of the project and then the build was all successful:
git submodule update --recursive
Another thing was the Java version. In some cases setting to Java 11 works. In my case 2 of the 4 modules had Java 17 dependency and another 2 modules had Java 11 dependency declared in their build.gradle. So I upgraded all their Java to Java 17 in their build.gradle file. When you change the Java version dependency, Sometimes you have to restart your computer to have the error gone.
Also one of the modules were from Unity And I had to copy the build folder for my own machine (M2 Silicone) and replace the current one there but I don't know if it is relevant.