【问题标题】:error appears in the appcompat versionappcompat 版本出现错误
【发布时间】:2018-06-25 06:30:09
【问题描述】:
dependencies {
   implementation fileTree(dir: 'libs', include: ['*.jar'])
   implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
   implementation 'com.android.support.constraint:constraint-layout:1.1.2'
   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'

   implementation 'com.google.firebase:firebase-core:16.0.0'
}

这会导致我的项目出错

错误日志:

所有 com.android.support 库必须使用完全相同的版本 规范(混合版本可能导致运行时崩溃)。成立 版本 28.0.0-alpha3、26.1.0。例子包括 com.android.support:animated-vector-drawable:28.0.0-alpha3 和 com.android.support:support-media-compat:26.1.0 少... (Ctrl+F1) 有一些库或工具和库的组合,它们 不兼容,或可能导致错误

【问题讨论】:

  • 你能发布错误吗?
  • 所有 com.android.support 库必须使用完全相同的版本规范(混合版本会导致运行时崩溃)。找到版本 28.0.0-alpha3、26.1.0。示例包括 com.android.support:animated-vector-drawable:28.0.0-alpha3 和 com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1) 有一些库的组合,或工具和库,不兼容或可能导致错误。

标签: android android-studio android-gradle-plugin


【解决方案1】:

Firebase-core:16.0.0 依赖项隐式依赖于支持库 26.1.0。因此,您需要通过添加相同的库但使用您的特定版本来覆盖它。例如:

dependencies {
   implementation fileTree(dir: 'libs', include: ['*.jar'])
   implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
   implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha3'
   implementation 'com.android.support:support-media-compat:28.0.0-alpha3'

   ...
   implementation 'com.google.firebase:firebase-core:16.0.0'
}

旁注,不要在生产代码中使用 alpha 版本的库。

【讨论】:

    【解决方案2】:

    Project>app>build.gradle 中,找到并更改它。

    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support:design:28.0.0-alpha3'
    

    【讨论】:

      【解决方案3】:

      为了解决这个问题,我也遇到了这个错误, 你应该修改 build.gradle 文件(Module:app), 来自:
      实现 'com.android.support:appcompat-v7:28.0.0-alpha3'

      到: 实现 'com.android.support:appcompat-v7:28.0.0-alpha1'

      我希望这能解决您的问题(对我有用)。

      【讨论】:

        【解决方案4】:

        添加这个

        implementation 'com.android.support:appcompat-v7:28.0.0'
        implementation 'com.android.support:support-v4:28.0.0'
        implementation 'com.android.support:design:28.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        implementation 'com.android.support:customtabs:28.0.0'
        

        【讨论】:

          猜你喜欢
          • 2018-02-25
          • 1970-01-01
          • 2018-12-12
          • 1970-01-01
          • 1970-01-01
          • 2018-06-29
          • 1970-01-01
          • 2017-09-05
          • 2017-02-15
          相关资源
          最近更新 更多