【问题标题】:XML resource conflict in Android libraryAndroid 库中的 XML 资源冲突
【发布时间】:2016-01-04 11:14:54
【问题描述】:

我通过 gradle 在我的 Android Studio 项目中导入了两个库。一个是 support library v7,它是在我的应用中针对不同平台处理操作栏的必要组件。另一种是我打算用于 UI 组件的,称为 MaterialDesign

问题是两个库都在它们的 values.xml 中定义了一个名为rippleColor 的属性,并且gradle 标识了冲突

如何告诉 gradle 排除一个定义并接受另一个定义? android 开发人员中心中的清单合并似乎在整个 xml 文件中执行此操作,而我的问题只是该文件中的一个特定属性。 有什么办法可以解决这个问题吗?

附:我的gradle依赖如下:

compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'org.xwalk:xwalk_core_library:15.44.384.13'
compile 'com.github.navasmdc:MaterialDesign:1.5@aar'

【问题讨论】:

  • 您确定在最新版本中同时使用这两个版本吗?
  • @piotrek1543 该问题没有解决问题。该错误源于重复声明:已定义属性“rippleColor”。似乎我们在自己的 xml 文件中有重复的声明。不同的版本不会定义rippleColor属性吗?这一定是我猜的问题
  • 发布您的依赖项
  • compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1 ' 编译 'com.android.support:design:23.1.1' 编译 'org.xwalk:xwalk_core_library:15.44.384.13' 编译 'com.github.navasmdc:MaterialDesign:1.5@aar'

标签: android android-studio gradle resources conflicting-libraries


【解决方案1】:

在成绩文件中写入以下代码。它可能会有所帮助:

dependencies {
    compile 'com.android.support:support-v4:22.2.1'
    compile 'com.google.code.gson:gson:2.2.2'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:design:22.2.1'

   compile fileTree(dir: 'libs', include: '*.jar')
    compile fileTree(include: ['*.jar'], dir: 'libs')
}

【讨论】:

  • 我添加了这些依赖项。 “rippleColor”属性仍然是重复的。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-01-13
  • 2013-02-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多