首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法解决依赖关系。无匹配变量

无法解决依赖关系。无匹配变量
EN

Stack Overflow用户
提问于 2021-02-17 11:38:57
回答 1查看 1.4K关注 0票数 3

我在Android项目中得到了由以下依赖引起的构建错误:

implementation "com.algolia:instantsearch-android:2.5.1"

它有助于升级到2.8.0,但我不喜欢,因为它需要minSdk 21。

第6.5级

Android Gradle插件: 4.0.2

科特林1.3.72

代码语言:javascript
复制
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')
EN

回答 1

Stack Overflow用户

发布于 2022-06-17 00:13:15

我的情况有点相似,但我的情况和你的略有不同。我将解释我和你的情况之间的区别,以及我为纠正这种情况所做的一切。这可能是你的问题的一个线索,但我会留给你看看它是否适用或有用。

在我的例子中,关于不兼容性的错误说,使用者有一个属性'org.jetbrains.kotlin.platform.type‘和值'androidJvm’,并且它发现我的依赖关系和值'jvm‘属性'org.jetbrains.kotlin.platform.type’。请注意,我没有关于其他属性和组件的确切文本和消息。但是当我分析这个消息时,明显的区别是'androidJvm‘和'jvm’。

我做错的是,我试图在java库中添加一个android库依赖项,当然,这是不允许的。我已经将‘java库’插件应用于该依赖项,而不是将'com.android.plugin‘应用于该库。我纠正了那个问题,当我离开的时候。

在你的例子中,你看起来有‘公共’和'androidJvm‘的区别。不幸的是,我不知道平台类型“公共”指的是什么。这可能是因为你所应用的插件类型。希望这能帮到你!

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66241227

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档