2015-09-30 30 views
0

我试图程序兼容性-V7添加到我的projct,但是当我运行gradle这个同步引发以下错误:错误上添加程序兼容性-V7 API级22

/路径/应用程序/编译/中间体/爆炸-aar/com.android.support/appcompat-v7/22.2.1/res/values/values.xml 错误:(2)属性“布局”已定义

这是我的build.gradle,其中我只需添加该行compile 'com.android.support:appcompat-v7:22.2.1'

/path/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/res/values/values.xml 
Error:(2) Attribute "layout" has already been defined 

    compileSdkVersion 22 
    buildToolsVersion "22.0.1" 

defaultConfig { 
    minSdkVersion 14 
    targetSdkVersion 22 
} 
... 
dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:support-v4:22.2.1' 
    compile 'com.android.support:appcompat-v7:22.2.1' 
    compile 'com.google.android.gms:play-services-analytics:7.3.0' 
    compile('org.simpleframework:simple-xml:2.7.1') { 
     exclude group: 'stax', module: 'stax-api' 
     exclude group: 'xpp3', module: 'xpp3' 
    } 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
} 

回答

0

日志真的能说明问题,我发现下面的代码片段上的文件res/values/attr.xml

<declare-styleable name="CustomListView"> 
    <attr name="layout" format="integer"/> 
</declare-styleable> 

我评论的代码和宾果!

0

这很可能是您的项目或你的一个依赖定义了一个'布局'属性。根据我的经验,当发生这种情况时,gradle输出包含的信息将导致您到达定义重复属性的位置。然后,您可以经常使用此信息来追踪并重命名冲突属性。如果您从Gradle粘贴完整输出,它可以帮助我们查明确切原因。

相关问题