Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

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.

like image 468
Bohsen Avatar asked Jul 29 '19 10:07

Bohsen


2 Answers

This problem is related to Android Studio 3.6 and ConstraintLayout versions earlier than 2.0.0-beta3 - I've reported the issue here. This is fixed in ConstraintLayout 2.0.0-beta3.

Android Studio 3.5 doesn't produce this error.

To make it work in AS 3.6 beta, upgrade to ConstraintLayout 2.0.0-beta3 or later.

like image 91
Bohsen Avatar answered Oct 27 '22 01:10

Bohsen


If even upgrading ConstraintLayout doesn't help, try to add format attribute to your attr declaration in your attrs.xml file.

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

Choose proper format for your attribute.

like image 35
Tigran Babajanyan Avatar answered Oct 27 '22 01:10

Tigran Babajanyan