简体   繁体   English

Android Motionlayout:Android 资源链接失败

[英]Android Motionlayout: Android resource linking failed

I keep getting build errors after a refactor to motionlayout 2.0.0-beta1 (I know it's not the newest version - beta2 produces same errors).在重构到motionlayout 2.0.0-beta1 后,我不断收到构建错误(我知道这不是最新版本——beta2 会产生相同的错误)。

Here's the stacktrace:这是堆栈跟踪:

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.

There's no indication as to what file produces the error and to my knowledge I don't use any of these attributes anywhere in my project.没有关于哪个文件产生错误的迹象,据我所知,我没有在我的项目中的任何地方使用任何这些属性。

This problem is related to Android Studio 3.6 and ConstraintLayout versions earlier than 2.0.0-beta3 - I've reported the issue here .此问题与 Android Studio 3.6 和早于 2.0.0-beta3 的 ConstraintLayout 版本有关 - 我已在此处报告该问题。 This is fixed in ConstraintLayout 2.0.0-beta3.这在 ConstraintLayout 2.0.0-beta3 中得到修复。

Android Studio 3.5 doesn't produce this error. Android Studio 3.5 不会产生此错误。

To make it work in AS 3.6 beta, upgrade to ConstraintLayout 2.0.0-beta3 or later.要使其在 AS 3.6 beta 中工作,请升级到 ConstraintLayout 2.0.0-beta3 或更高版本。

If even upgrading ConstraintLayout doesn't help, try to add format attribute to your attr declaration in your attrs.xml file.如果即使升级ConstraintLayout也无济于事,请尝试将format属性添加到attrs.xml文件中的attr声明中。

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

Choose proper format for your attribute.为您的属性选择正确的格式。

upgrading to constraintlayout:2.0.0-beta4, worked for me , or later version.升级到constraintlayout:2.0.0-beta4,为我工作,或更高版本。 This happens after you upgrade android studio to 3.6将 android studio 升级到 3.6 后会发生这种情况

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

You would have to do two things:你必须做两件事:

  1. Update your android studio.更新你的安卓工作室。

  2. add Latest dependency implementation添加最新的依赖实现

    'androidx.constraintlayout:constraintlayout:2.0.0-rc1'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM