android studio no matching variant of project - android

After update Android Studio and create the first project I see:
A problem occurred configuring root project 'Demo Sample'.
Could not resolve all files for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:7.4.0-rc03.
Required by:
project : com.android.application:com.android.application.gradle.plugin:7.4.0-rc03
project : com.android.library:com.android.library.gradle.plugin:7.4.0-rc03
No matching variant of com.android.tools.build:gradle:7.4.0-rc03 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:
- Variant 'apiElements' capability com.android.tools.build:gradle:7.4.0-rc03 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.0-rc03 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.0-rc03 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.0-rc03 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')

I fixed:
Step 1, open notifications:
Step 2, click select the Gradle JDK Location
Step 3 Select Embedded JDK

Related

Gradle project sync failed after Electric Eel | 2022.1.1 update

After updating my Android Studio to the latest version i.e. Electric Eel | 2022.1.1, I got "Gradle project sync failed" after creating a new project.
Error:
A problem occurred configuring root project 'BIAssignment'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:7.4.0.
Required by:
project : > com.android.application:com.android.application.gradle.plugin:7.4.0
project : > com.android.library:com.android.library.gradle.plugin:7.4.0
> No matching variant of com.android.tools.build:gradle:7.4.0 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:
- Variant 'apiElements' capability com.android.tools.build:gradle:7.4.0 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.0 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.0 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
- Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.0 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
I have already tried Invalidating Cache and changing Gradle version from Project Structure but neither of them worked. I also tried disabling Flutter plugin, but none of these methods work please help me solving this problem.
My current project structure:
build.gradle
plugins {
id 'com.android.application' version '7.4.0' apply false
id 'com.android.library' version '7.4.0' apply false
}
build.gradle
plugins {
id 'com.android.application'
}
android {
namespace 'com.biassignment'
compileSdk 33
defaultConfig {
applicationId "com.biassignment"
minSdk 24
targetSdk 33
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
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment:2.5.3'
implementation 'androidx.navigation:navigation-ui:2.5.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
I solved the problem by changing the Android Gradle Plugin Version and Gradle Version.
File > Project Structure > Project
I changed this
to
Adding Fani comment:
Changing Gradle JDK to version 11 also worked for me.
File > Settings > Build, Execution, Deployment > Build Tools > Gradle.
Change the Gradle JDK to version 11.
Ok as I see all the thing is right just go to :
Project structure --> Modules
and change the Source $ Target compatibility from "$JavaVersion.VERSION_1_8" to "$JavaVersion.VERSION_11"
I ran into the same problem and applied the following solution :
I have changed the Gradle JDK to 11 and issue is resolved.
I had the same problem after upgrading Android Studio. You can reset Android Studio to its default state by following the instructions in the "Known Issues with Android Studio" page at section "Studio doesn't start after upgrade".
Reset Android Studio state: https://developer.android.com/studio/known-issues#studio-config-directories
Caution: All third-party plugins will be removed when you do this
By the way, changing the gradle version also worked for me (this answer).
I never answered a question before, please tell me if I'm missing something
Had the same error and upgraded to these Gradle settings
I also changed the Gradle JDK to:

Could not resolve all artifacts for configuration ':qr_code_scanner:classpath'

Am unable to get around this error after upgrading flutter version to 3.0.4. from version 2.10
Error
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':qr_code_scanner'.
> Could not resolve all artifacts for configuration ':qr_code_scanner:classpath'.
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10.
Required by:
project :qr_code_scanner
> The consumer was configured to find a runtime of a component compatible with Java 11, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10:
- gradle70JavadocElements
- gradle70RuntimeElements
- gradle70SourcesElements
- javadocElements
- runtimeElementsWithFixedAttribute
- sourcesElements
All of them match the consumer attributes:
- Variant 'gradle70JavadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides javadocs but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'gradle70RuntimeElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides a library but the consumer didn't ask for it
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'gradle70SourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides sources but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'javadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides javadocs but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides release status but the consumer didn't ask for it
- Variant 'runtimeElementsWithFixedAttribute' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides a library but the consumer didn't ask for it
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'sourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a runtime of a component, and its dependencies declared externally:
- Unmatched attributes:
- Provides documentation but the consumer didn't ask for it
- Provides sources but the consumer didn't ask for it
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Provides release status but the consumer didn't ask for it
The following variants were also considered but didn't match the requested attributes:
- Variant 'apiElementsWithFixedAttribute' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Variant 'gradle70ApiElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for project ':qr_code_scanner' of type org.gradle.api.Project.
> Could not get unknown property 'android' for project ':qr_code_scanner' of type org.gradle.api.Project.
I dont understand where the issue is. Any assistance will be much appreciated
gradle file
buildscript {
ext.kotlin_version = '1.5.10'
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.4' // Google Services plugin
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Flutter doctor output
[√] Flutter (Channel stable, 3.0.4, on Microsoft Windows [Version 10.0.19044.1889], locale en-us)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.67.0)
[√] Connected device (3 available)
[√] HTTP Host Availability
i have tried changing kotlin versions manually but didn't work, also tried building the app from clean workstation and got the same error, reduced the qr scanner version from 4.0 to 1.0 but no fruits
This will work :)
ext.kotlin_version = '1.7.10'
classpath 'com.android.tools.build:gradle:4.2.0'
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

Could not resolve dependency. No matching variant

I'm getting build errors in Android project caused by the following dependency:
implementation "com.algolia:instantsearch-android:2.5.1"
It helps to upgrade to 2.8.0 but I would prefer not since it requires minSdk 21.
Gradle 6.5
Android Gradle Plugin: 4.0.2
Kotlin 1.3.72
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:releaseCompileClasspath'.
> Could not resolve com.algolia:algoliasearch-client-kotlin-common:1.4.0.
Required by:
project :app > com.algolia:instantsearch-android:2.5.1
> No matching variant of com.algolia:algoliasearch-client-kotlin-common:1.4.0 was found. The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
- Variant 'metadata-api' capability com.algolia:algoliasearch-client-kotlin-common:1.4.0:
- Incompatible because this component declares a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'
- Other compatible attribute:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
I had a somewhat similar situation, but my case was slightly different than yours. I'll explain the difference between my situation and yours along with what I did to correct the situation. This might be a clue to your problem, but I'll leave it to you to see if it's applicable or helpful.
In my case, the error about incompatibility said that that the consumer had an attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and that it found that my dependency had and attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'. Please note that I don't have the exact text and the message talked about other attributes and components. But when I parsed the message the obvious difference was the 'androidJvm' and 'jvm'.
What I did wrong, was that I was trying to add an android library dependency to a java library, and of course, that's not allowed. I had applied the 'java-library' plugin to the dependency instead of applying the 'com.android.plugin' to that library. I corrected that and the problem when away.
In your case, it looks like you have the difference 'common' versus 'androidJvm'. Unfortunately, I don't know what the platform type 'common' is referring to. It's probably due to the type of plugin you've got applied. Hopefully this helps you!

Use Kotlin Multiplatform Library from JFrog Artifactory

I uploaded a shared module from a Kotlin Multiplatform to JFrogs Artifactory. The goal is to use this shared module in another android app project and share business logic across projects.
I tried to only upload the android variant of the shared module - for the current purpose the iOS variant are not needed to be uploaded to artifactory.
I wrote this code in the build.gradle.kts of the shared module in the Kotlin Multiplatform project:
plugins {
kotlin("multiplatform")
id("com.android.library")
id("kotlin-android-extensions")
kotlin("plugin.serialization")
// plugins required for uploading to artifactory
id("maven-publish")
id("com.jfrog.artifactory") version "4.13.0"
}
.
.
.
artifactory {
setContextUrl("https://rbartifactory.jfrog.io/artifactory/")
publish(delegateClosureOf<PublisherConfig> {
repository(delegateClosureOf<DoubleDelegateWrapper> {
setProperty("repoKey", "App-Shared-Test-KMP")
setProperty("username", "<MY-USERNAME>")
setProperty("password", "<MY-USER-API-KEY>")
setProperty("maven", true)
})
defaults(delegateClosureOf<groovy.lang.GroovyObject> {
invokeMethod("publications", arrayOf(
"androidDebug", "androidRelease", "kotlinMultiplatform", "metadata"
))
})
})
}
In the settings.gradle I also added enableFeaturePreview("GRADLE_METADATA").
To implement that gradle I read this article here: https://medium.com/vmware-end-user-computing/publishing-kotlin-multiplatform-artifacts-to-artifactory-maven-a283ae5912d6
Because I want this shared module to be used in other Android App projects I skip all steps regarding the maven publications of the iOS part.
The upload to artifactory is successful with ./gradlew artifactoryPublish:
I try to consume it in the android app and for this I added the connection to artifactory and to this repo in the android app build.gradle file like suggested in artifactory when using "Set Me Up" button. And I also link finally the framework in the dependencies block of the build.gradle of the Android App:
dependencies {
.
.
.
implementation(group: 'com.rb.kmp_test_shared_lib', name: 'shared', version: '1.0.4', ext: 'jar')
}
In the android app I run in this error here:
Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
> Could not resolve com.rb.kmp_test_shared_lib:shared:1.0.4.
Required by:
project :app
> No matching variant of com.rb.kmp_test_shared_lib:shared:1.0.4 was found. The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
- Variant 'commonMainMetadataElements-published' capability com.rb.kmp_test_shared_lib:shared:1.0.4:
- Incompatible because this component declares a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'
- Other compatible attribute:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
- Variant 'iosArm64ApiElements-published' capability com.rb.kmp_test_shared_lib:shared:1.0.4:
- Incompatible because this component declares a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native' and the consumer needed an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'
- Other compatible attribute:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
- Variant 'iosArm64MetadataElements-published' capability com.rb.kmp_test_shared_lib:shared:1.0.4:
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native' and the consumer needed an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'
- Other compatible attribute:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
- Variant 'iosX64ApiElements-published' capability com.rb.kmp_test_shared_lib:shared:1.0.4:
- Incompatible because this component declares a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native' and the consumer needed an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'
- Other compatible attribute:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
- Variant 'iosX64MetadataElements-published' capability com.rb.kmp_test_shared_lib:shared:1.0.4:
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native' and the consumer needed an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'
- Other compatible attribute:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
- Variant 'metadataApiElements-published' capability com.rb.kmp_test_shared_lib:shared:1.0.4:
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'
- Other compatible attribute:
- Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
* 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.
Why did I get this error when trying to use that library? How can I exactly consume Kotlin Multiplatform libraries from jfrogs artifactory in other android apps?
It is maybe because of the jars which get uploaded by running ./gradlew artifactoryPublish? There should be aar files uploaded in artifactory?
Maybe this lines here did not work anymore? The article I read to implement that was written in May 2020 and since then there were some major Kotlin Multiplatform releases:
defaults(delegateClosureOf<groovy.lang.GroovyObject> {
invokeMethod("publications", arrayOf(
"androidDebug", "androidRelease", "kotlinMultiplatform", "metadata"
))
})
I guess instead of androidDebug and androidRelease I need to put there some other attributes in.
I am really grateful for every help with this - I am looking for hours for an solution.
For android apps aar libraries are necessary - so I need to upload air files to artifactory.
To upload aar files I add a publishing block to the build.gradle.kts of my shared module in the KMP project:
publishing {
publications {
create<MavenPublication>("aar") {
artifact("$buildDir/outputs/aar/${project.name}-release.aar")
}
}
}
I also changed the artifactory block and replace the defaults part to this:
defaults(delegateClosureOf<groovy.lang.GroovyObject> {
invokeMethod("publications", "aar")
setProperty("publishArtifacts", true)
})
After this changes I clean the project and build all artifacts:
./gradlew clean
./gradlew :shared:build
When all assets build successful (and aar files are in the outputs folder of the KMP project) I upload the aar's successful with ./gradlew artifactoryPublish and then I can simply use them in another android app.
The answer from Vadim of the question Convert to gradle-kotlin-dsl Jfrog.Artifactory config helped me with writing the code to upload aar's to artifactory.

Cannot choose between the following variants of project :features:myDynamicFeatureModule:

I am experimenting with Android's Dynamic Feature Modules (a.k.a. on demand modules) on the side of the project I am working on.
In my PoC (proof-of-concept) project, Dynamic Feature Modules (DFM) work fine and gradle builds the project with no issue. After finishing with my PoC, I decided to apply it to an existing project. However, gradle failed building the project with:
Could not determine the dependencies of task ':my-app:checkSomeBuildFlavorDebugLibraries'.
> Could not resolve all task dependencies for configuration ':my-app:someBuildFlavorDebugMetadataValues'.
> Could not resolve project :features:myDynamicFeatureModule.
Required by:
project :my-app
> Cannot choose between the following variants of project :features:myDynamicFeatureModule:
- anotherBuildFlavorDebugAndroidTestCompile
- anotherBuildFlavorDebugAndroidTestRuntime
- ...
All of them match the consumer attributes:
- Variant 'anotherBuildFlavorDebugAndroidTestCompile' capability myproject.features:myDynamicFeatureModule:unspecified:
- Unmatched attributes:
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' but no value provided.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Metadata' but no value provided.
- Required endpoint 'someBuildFlavor' but no value provided.
- Found org.jetbrains.kotlin.localToProject 'local to :features:myDynamicFeatureModule' but wasn't required.
- Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required.
- Variant ...
Note that this error is quite long, iterating through all possible flavors.
What I have tried, but did not work:
I added exactly the same flavors that base module (my-app) has in my dynamic module
In build.gradle of my DFM, I tried to set configuration explicitly like : implementation project(path: ':my-app', configuration: 'default') and also configuration: 'someFlavor'
In build.gradle of the base module (my-app) I used missingDimensionStrategy 'mydimension', 'myflavor'
Building from Android Studio and also from terminal
Removing dependencies and other code from build.gradle files
What I have tried and it worked:
Removing the dependency of base app (my-app) from DFM (i.e. removing implementation project(':my-app',) ) - but I need it. Just to clarify, the DFM applies the following gradle plugins: com.android.dynamic-feature and kotlin-android
Removing all flavors from the base app and DFM - but I need them in the base app.
The PoC I made works fine and gradle compiles the project even with the same flavors I use in my actual project
Notes:
I use DexGuard (but I disabled it to make sure it isn't interfering)
I don't have any custom build types, only 'debug' and 'release'
Gradle version is 3.5.2
Gradle wrapper is 5.5.1
Both the PoC and my actual project use the same versions of gradle, gradle wrapper, build types and flavors
Unfortunately I could not reproduce the problem in a separate project. I tried removing as much of things as possible from my project but I could not resolve the issue.
Do you have any idea what could be causing this issue and how could I possibly fix it? Thank you!
I had this issue and it was due to not removing the implementation project(':features:myDynamicFeatureModule') line from my app module's gradle file.

Categories

Resources