Reputation: 145
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')
Upvotes: 3
Views: 2497
Reputation: 1702
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!
Upvotes: 2