1

当我使用com.android.support.constraint:constraint-layout:2.0.0-beta2 我得到以下构建错误。

如果我使用com.android.support.constraint:constraint-layout:2.0.0-alpha2,我不会收到任何错误。

为什么我会收到这些错误?如何摆脱这个?

我看到 app:alpha 在https://androidstudio.googleblog.com/2019/05/constraintlayout-200-beta-1.html中被重命名为 android:alpha

构建失败日志:

/home/user/MyApp/build/intermediates/res/merged/myFlavor/debug/values/values.xml:949: AAPT: Attribute "android:alpha" has already been defined

/home/user/MyApp/build/intermediates/res/merged/myFlavor/debug/values/values.xml:1017: AAPT: Attribute "android:translationX" has already been defined

/home/user/MyApp/build/intermediates/res/merged/myFlavor/debug/values/values.xml:1017: AAPT: Attribute "android:translationY" has already been defined

/home/user/MyApp/build/intermediates/res/merged/myFlavor/debug/values/values.xml:1017: AAPT: Attribute "android:translationZ" has already been defined

/home/user/MyApp/build/intermediates/res/merged/myFlavor/debug/values/values.xml:949: error: Attribute "android:alpha" has already been defined
/home/user/MyApp/build/intermediates/res/merged/myFlavor/debug/values/values.xml:1017: error: Attribute "android:translationX" has already been defined
/home/user/MyApp/build/intermediates/res/merged/myFlavor/debug/values/values.xml:1017: error: Attribute "android:translationY" has already been defined
/home/user/MyApp/build/intermediates/res/merged/myFlavor/debug/values/values.xml:1017: error: Attribute "android:translationZ" has already been defined

:MyApp:processMyFlavorDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':MyApp:processMyFlavorDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
4

1 回答 1

0

在项目的 build.gradle 文件中更新高于 3.0.1 的 gradle 插件版本。

classpath 'com.android.tools.build:gradle:3.0.1'

这个对我有用

于 2020-11-04T13:36:16.290 回答