【问题标题】:libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-alpha1, 26.1.0库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 28.0.0-alpha1、26.1.0
【发布时间】:2018-08-21 12:08:45
【问题描述】:

所有 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 少... (Ctrl+F1) 有 一些库或工具和库的组合,它们是 不兼容,或者可能导致错误。一种这样的不兼容性是 使用不支持的 Android 支持库版本进行编译 最新版本(或者特别是低于您的 targetSdkVersion)。

我的 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.+'

>

【问题讨论】:

  • 查看link
  • 您使用的是不同版本的 firebase,这本身就很糟糕。他们每个人都使用它的支持库的 ovn 版本,这导致了这个消息
  • 什么是compileSdkVersion?
  • compileSdkVersion 为 28
  • 我正在使用最新版本的 firebase @VladyslavMatviienko

标签: android firebase android-gradle-plugin build.gradle


【解决方案1】:

某些东西正在使用旧库,罪魁祸首是 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'
}

这种行为让新开发人员头疼。

如果这解决了您的问题,请让其他人也知道。 编码愉快。

更新

注意:不要忘记检查是否有其他库添加到您的项目中导致警告。

它的工作证明。

【讨论】:

  • 检查其他内容。像 firabase 广告。说出使用此方法后收到的警告。也添加它们,它会起作用。
  • @JayminBhadani 也许您没有正确测试它。因为它有最新的 rc-01 版本和你的 alpha-1。
  • rc-01 有同样的问题..!这个问题与freebase lib版本有关,如果我删除freebase lib它可以工作,但我需要它谢谢。!
【解决方案2】:
implementation ("com.theartofdev.edmodo:android-image-cropper:2.3.+"){
    exclude group: 'com.android.support'
}

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

【讨论】:

【解决方案3】:

在下面使用这个依赖项

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

【讨论】:

    【解决方案4】:

    这是因为您的图像裁剪库包含旧版本的支持库。在您的 Image Cropper 库中使用它:

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

    这将消除您的 gradle 问题。

    【讨论】:

    • 然后将相同的东西一一添加到 Facebook 和翻译库,直到您摆脱错误为止。
    • 也可以试试翻译。我确信图像裁剪器使用的是旧版本,因为我使用它。
    • 译者在哪里,请描述一下?
    • 同样添加到 microsoft-translator-java-api 库
    【解决方案5】:

    使用此依赖项

    implementation 'com.android.support:appcompat-v7:27.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。”
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多