14

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.

Bohsen
  • 3,848
  • 3
  • 26
  • 46

5 Answers5

38

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.

Bohsen
  • 3,848
  • 3
  • 26
  • 46
  • 1
    We have to downgrade? – IgorGanapolsky Sep 08 '19 at 17:00
  • 1
    @IgorGanapolsky No, there's a workaround. See my edited answer. – Bohsen Sep 08 '19 at 19:14
  • 3
    You can now update to constraint layout beta3 which fixes the issue. – Laimiux Oct 28 '19 at 19:44
  • @Laimiux How to upgrade the ContraintLayout? I'm new to android and using studio canary 4. Does it mean that the Motion example on android github page is obsolete? https://github.com/android/animation-samples/tree/master/Motion – Unknown123 Feb 25 '20 at 17:33
  • 2
    I've just learnt it. `File > Project Structure > Dependencies > All Modules > Add Dependency (Plus button) > Library Dependency > On Step 1, search "androidx.constraintlayout" > choose the latest version (at the moment it is 2.0.0-beta4) > OK > OK` Done. It has an information message, "Gradle promoted library version from 2.0.0-beta2 to 2.0.0-beta4". Now you can build it and run it. – Unknown123 Feb 25 '20 at 18:09
  • 2
    implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta4" upgrading to this beta version of constraintlayout worked for me – kalya Feb 28 '20 at 12:12
4

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.

Tigran Babajanyan
  • 1,725
  • 17
  • 36
  • 2
    After upgrading android studio 3.6 and gradle plugin to latest version faced this issue. Adding format solved the issue. – Bek Mar 13 '20 at 10:55
2

upgrading to constraintlayout:2.0.0-beta4, worked for me , or later version. This happens after you upgrade android studio to 3.6

kalya
  • 309
  • 2
  • 4
1

I upgraded gradle version to com.android.tools.build:gradle:3.6.0 then faced this issues, just downgrade gradle version to com.android.tools.build:gradle:3.5.3 and problem resolved

Sumit
  • 832
  • 10
  • 18
0

You would have to do two things:

  1. Update your android studio.

  2. add Latest dependency implementation

    'androidx.constraintlayout:constraintlayout:2.0.0-rc1'

Hadi Mirzaei
  • 232
  • 2
  • 16