我现在有一个正在运行的项目,我想在启动屏幕之后添加一个新活动,但是这给了我错误,甚至在添加新活动后也没有建立。这是我尝试构建时显示的错误。
org.gradle.internal.UncheckedException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Users\Naji\.gradle\caches\transforms-1\files-1.1\design-23.4.0.aar\69146a3caf23a06bf4da884e96918fae\res\values\values.xml:19:5-827: AAPT: error: duplicate value for resource 'attr/layout_anchorGravity' with config ''.
C:\Users\Naji\.gradle\caches\transforms-1\files-1.1\design-23.4.0.aar\69146a3caf23a06bf4da884e96918fae\res\values\values.xml:19:5-827: AAPT: error: resource previously defined here.
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:47)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:44)
at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:79)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:44)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:62)
at
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Users\Naji\.gradle\caches\transforms-1\files-1.1\design-23.4.0.aar\69146a3caf23a06bf4da884e96918fae\res\values\values.xml:19:5-827: AAPT: error: duplicate value for resource 'attr/layout_anchorGravity' with config ''
答案 0 :(得分:0)
解决此问题:
res\values\values.xml duplicate value for resource 'attr/layout_anchorGravity'
也请在我的案例中验证重复的Attrs
<declare-styleable name="CustomLay">
<attr name="lay" format="string" />
</declare-styleable>
我要更改的内容这是问题所在,我已通过重命名attr名称解决了该问题
<declare-styleable name="CustomLay">
<attr name="layName" format="string" />
</declare-styleable>