我无法在android studio中添加这个库:compile' com.android.support:design:24.0.0'

时间:2016-10-19 10:13:33

标签: android gradle

当我在我的依赖项中添加了这个库compile 'com.android.support:design:24.0.0'时,我遇到了以下错误:

Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources]
Error:(253) Original attribute defined here.
C:\Users\Jamshidi\AndroidStudioProjects\School\School\app\build\intermediates\res\merged\debug\values\values.xml
Error:(257) Attribute "rippleColor" already defined with incompatible format.
Error:(257) Attribute "rippleColor" already defined with incompatible format.
Error:(253) Original attribute defined here.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
Information:BUILD FAILED
Information:Total time: 26.882 secs
Information:5 errors
Information:0 warnings
Information:See complete output in console

我该如何解决:

我的build.gradle文件包含以下内容:

 dependencies {
   compile fileTree(include: ['*.jar'], dir: 'libs')
   testCompile 'junit:junit:4.12'
   compile 'com.android.support:appcompat-v7:24.0.0'
   compile 'com.android.support:cardview-v7:24.0.0'
   compile 'com.wrapp.floatlabelededittext:library:0.0.6'
   compile 'com.github.navasmdc:MaterialDesign:1.5@aar'
   compile 'com.squareup.picasso:picasso:2.3.2'
   compile 'com.nineoldandroids:library:2.4.0'
   compile 'com.daimajia.slider:library:1.1.5@aar'
   compile 'com.android.support:support-v4:24.1.0'
   compile 'com.baoyz.pullrefreshlayout:library:1.2.0'
   compile 'com.android.support:design:24.0.0'

2 个答案:

答案 0 :(得分:1)

我猜你有这个错误,因为'com.android.support:design:22.2.0''com.github.navasmdc:MaterialDesign:1.5@aar' 库具有相同的属性rippleColor

要解决此冲突,您可以:

  1. 克隆一个库(com.android.support:design:22.2.0com.github.navasmdc:MaterialDesign:1.5@aar),重命名该属性,导入到您的项目中。
  2. 将第三方库替换为thisthis或其他。

答案 1 :(得分:0)

问题很简单。正如Milad所说,两个依赖项都使用相同的属性,在编译和形成合并的.XML文件时,编译器面临着一个问题。

试试这个 https://github.com/vajro/MaterialDesignLibrary

希望它有效。