【发布时间】:2017-10-16 16:05:57
【问题描述】:
依赖{ 编译 fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:preference-v7:25.3.1'
compile 'com.google.code.findbugs:jsr305:3.0.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'ch.acra:acra:4.9.2'
compile 'com.github.yukuku:ambilwarna:2.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
testCompile 'junit:junit:4.12'
}
这是 gradle 依赖代码。我收到此类错误。 当我单击此错误时,代码显示 .cannot find decleration of element 'recources'。 D:\AndroidProjects\Tech\app\build\intermediates\res\merged\debug\values\values.xml 错误:(360) 属性“navigationMode”已使用不兼容的格式定义。
Error:(155) Original attribute defined here.
Error:(367) Attribute "displayOptions" already defined with incompatible format.
Error:(687) Attribute "backgroundTintMode" already defined with incompatible format.
Error:(367) Attribute "displayOptions" already defined with incompatible format.
Error:(360) Attribute "navigationMode" already defined with incompatible format.
Error:(419) Attribute "actionBarSize" already defined with incompatible format.
Error:(70) Original attribute defined here.
Error:(482) Attribute "buttonTintMode" already defined with incompatible format.
Error:(7) Original attribute defined here.
Error:(102) Original attribute defined here.
Error:(576) Attribute "showDividers" already defined with incompatible format.
Error:(360) Attribute "navigationMode" already defined with incompatible format.
Error:(184) Original attribute defined here.
Error:(601) Attribute "showAsAction" already defined with incompatible format.
Error:(191) Original attribute defined here.
Error:(52) Original attribute defined here.
Error:(155) Original attribute defined here.
Error:(102) Original attribute defined here.
Error:(419) Attribute "actionBarSize" already defined with incompatible format.
Error:(7) Original attribute defined here.
Error:(482) Attribute "buttonTintMode" already defined with incompatible format.
Error:(70) Original attribute defined here.
Error:(576) Attribute "showDividers" already defined with incompatible format.
Error:(191) Original attribute defined here.
Error:(601) Attribute "showAsAction" already defined with incompatible format.
Error:(184) Original attribute defined here.
Error:(687) Attribute "backgroundTintMode" already defined with incompatible format.
Error:(52) Original attribute defined here.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
【问题讨论】:
-
如果您在 Android Studio 中按下警告,它很可能会将您带到发生错误的行。将您被带到的整个文件(如果您被带到一个文件)复制到您的问题中
-
添加依赖项后出现这些错误?
-
是的,添加依赖项后出现此错误 -Kriti
-
感谢@LunarWatcher,但我可以复制整个代码,因为代码太大。
-
我解决了我的问题。我更改了这些属性 'displayOptions',"backgroundTintMode","navigationMode","actionBarSize","showAsAction"。这些属性名称应该在 attrs.xml 文件中更改。我对这些属性进行了命名。之后我的问题就解决了。