14

在对 motionlayout 2.0.0-beta1 进行重构后,我不断收到构建错误(我知道它不是最新版本 - beta2 会产生相同的错误)。

这是堆栈跟踪:

AAPT: /Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6514: error: resource attr/flow_horizontalSeparator (aka com.example:attr/flow_horizontalSeparator) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6514: error: resource attr/flow_verticalSeparator (aka com.example:attr/flow_verticalSeparator) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6515: error: resource attr/flow_horizontalSeparator (aka com.example:attr/flow_horizontalSeparator) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6515: error: resource attr/flow_verticalSeparator (aka com.example:attr/flow_verticalSeparator) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6517: error: resource attr/flow_horizontalSeparator (aka com.example:attr/flow_horizontalSeparator) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6517: error: resource attr/flow_verticalSeparator (aka com.example:attr/flow_verticalSeparator) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6517: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6860: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6861: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6876: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6877: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:6877: error: resource attr/waveDecay (aka com.example:attr/waveDecay) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:7288: error: resource attr/motionPathRotate (aka com.example:attr/motionPathRotate) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:7290: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:7549: error: resource attr/motionProgress (aka com.example:attr/motionProgress) not found.
/Users/TBS/StudioProjects/ExampleApp/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:8270: error: resource attr/duration (aka com.example:attr/duration) not found.
error: failed linking references.

没有迹象表明哪个文件会产生错误,据我所知,我在项目的任何地方都没有使用这些属性中的任何一个。

4

5 回答 5

38

此问题与早于 2.0.0-beta3 的 Android Studio 3.6 和 ConstraintLayout 版本有关 - 我已在此处报告此问题。这在 ConstraintLayout 2.0.0-beta3 中已修复。

Android Studio 3.5 不会产生此错误。

要使其在 AS 3.6 beta 中工作,请升级到 ConstraintLayout 2.0.0-beta3 或更高版本。

于 2019-07-31T08:36:19.547 回答
4

如果即使升级ConstraintLayout也无济于事,请尝试在attrs.xml文件中的attr声明中添加格式属性。

<resources>
    <attr name="yourAttrName" format="string" />
</resources>

为您的属性选择适当的格式。

于 2020-02-27T07:06:50.683 回答
2

升级到 constraintlayout:2.0.0-beta4,为我工作,或更高版本。将 android studio 升级到 3.6 后会发生这种情况

于 2020-02-28T12:14:33.067 回答
1

我将 gradle 版本升级到com.android.tools.build:gradle:3.6.0然后遇到了这个问题,只需将 gradle 版本降级到com.android.tools.build:gradle:3.5.3并解决问题

于 2020-05-06T12:25:25.703 回答
0

你必须做两件事:

  1. 更新你的安卓工作室。

  2. 添加最新的依赖实现

    'androidx.constraintlayout:constraintlayout:2.0.0-rc1'

于 2020-08-20T16:55:44.367 回答