库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。发现版本为28.0.0-alpha1、26.1.0。

4

所有的com.android.support库必须使用完全相同的版本(混合使用版本可能导致运行时崩溃)。发现的版本是28.0.0-alpha1、26.1.0。例如:com.android.support:animated-vector-drawable:28.0.0-alpha1 和 com.android.support:customtabs:26.1.0等等。有些库、工具和库的组合是不兼容的,或者可能会导致错误。其中一种不兼容性是使用非最新版本(或特别是低于你的targetSdkVersion版本)的Android support库进行编译。

我的gradle依赖:

implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'

这些依赖项存在警告 -----------------------------

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
testImplementation 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services-vision:15.0.2'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
implementation 'com.memetix:microsoft-translator-java-api:0.6.2'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.facebook.android:audience-network-sdk:4.+'

enter image description here

enter image description here>


请查看此链接 - Sunny
你正在使用不同版本的Firebase,这本身就是不好的。它们每个都使用自己的支持库版本,这导致了这个消息。 - Vladyslav Matviienko
什么是compileSdkVersion? - Rahul Chokshi
compileSdkVersion 是 28。 - Jaymin Bhadani
抱歉,我想要使用最新的compileSdkVersion“28”来解决问题。 - Jaymin Bhadani
显示剩余4条评论
5个回答

6

有些东西正在使用较旧的库,罪魁祸首是firebase-core:16〜;

经过一番尝试,我解决了这个问题。

this answere this answer 中,我解决了这个错误。

您需要手动添加冲突的依赖项。(查找冲突的依赖项的简单方法是将鼠标悬停在突出显示的错误上。) 您可以降级您的appcompat库到给定/提示的库,但这不是推荐的方法,或者手动声明这些依赖项。

我今天使用了所有更新的库,并使用了这个代码解决了错误:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:28.0.0-rc01'

implementation 'com.android.support.constraint:constraint-layout:1.1.2'

//this thing is carusing error, to solve - see hints and manually add them.

implementation 'com.google.firebase:firebase-core:16.0.1'

implementation 'com.android.support:support-media-compat:28.0.0-rc01'

implementation 'com.android.support:support-v4:28.0.0-rc01'


//implementation 'com.android.support:appcompat-v7:25.2.0'
/*implementation ("com.google.firebase:firebase-core:16.0.1"){
    exclude group: 'com.android.support'
}
*/

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

这种行为让新开发者感到困惑。
如果这解决了你的问题,请告诉其他人。 愉快的编码。
更新。
注意:不要忘记检查是否有其他库添加到您的项目中导致警告。
其工作的证明。 enter image description here

1
检查其他内容,例如Firebase广告。在使用此方法后,说出您收到的警告。将它们添加进去,它就会正常工作。 - Rifat
@JayminBhadani 也许你没有正确地进行测试。因为它有最新的rc-01版本,而你的是alpha-1。 - bulliedMonster
同样的问题出现在rc-01版本上..!这个问题与Freebase库的版本有关,如果我删除Freebase库,它可以工作,但我需要它,谢谢! - Jaymin Bhadani

1
这是由于您的图像裁剪库包含较旧版本的支持库引起的。在您的图像裁剪库中使用以下内容:
implementation ("com.theartofdev.edmodo:android-image-cropper:2.3.+"){
    exclude group: 'com.android.support'
}

这将解决您的Gradle问题。


然后逐一将相同的内容添加到Facebook和Translator库中,直到您消除错误。 - nitinkumarp
我确定图像裁剪器使用的是较旧版本,因为我使用过它。 - nitinkumarp
翻译器在哪里,请描述一下它。 - Jaymin Bhadani
将“add same to microsoft-translator-java-api”库的内容进行添加。 - nitinkumarp

1

使用此依赖项

implementation 'com.android.support:appcompat-v7:27.1.1'


1
当使用这些依赖项时,会收到以下警告:“所有com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。发现版本27.1.1、26.1.0。示例包括com.android.support:animated-vector-drawable:27.1.1和com.android.support:customtabs:26.1。” - Jaymin Bhadani

1
使用下面的依赖项:
implementation 'com.android.support:support-v4:28.0.0'

1
implementation ("com.theartofdev.edmodo:android-image-cropper:2.3.+"){
    exclude group: 'com.android.support'
}

nitinkumarp提供了工作建议。也许冲突有几个依赖关系。您需要检查每一个,移除所有依赖项,并逐个添加和同步,直到出现警告。这将是导致警告的依赖关系。


这似乎是对nitinkumarp这个回答的评论,已作为单独的答案发布。 - Wai Ha Lee

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接