4

I'm using the recently released constraint layout version 2.0 and they have added a new feature called Flow which basically replaces what linear layout used to do ( with more customization ). But the android lint is blocking my CI from building because it thinks the views are missing constraint. Suppressing this lint error for each of these views seems a plan B so am asking if there is a way to update lint independently from other components of the Gradle.

Currently running:

  • Gradle = 6.1.1
  • AndroidGradlePlugin = 4.0.1
  • Kotlin = 1.4
Brook MG
  • 601
  • 10
  • 20
  • 2
    You can add `tools:ignore="MissingConstraints"` to the _ConstraintLayout_ to suppress the warning for all of its children. This will effect elements of _Flow_ as well as all others, so it's not a perfect solution. Lint really needs to be updated to suppress this warning for members of _Flow_ if constraints are not truly needed. – Cheticamp Sep 02 '20 at 18:33
  • Yes, I ended up doing this. You can also define `lint.xml` file at the root of the project to ignore certain paths. Let's wait until they update lint then. – Brook MG Sep 02 '20 at 20:08

2 Answers2

5

Make sure that you don't have spaces between ids values in app:constraint_referenced_ids attribute so if you have e.g. this:

app:constraint_referenced_ids="view_1, view_2, view_3"

you should rewrite it to:

app:constraint_referenced_ids="view_1,view_2,view_3"

also you can suppress such warning for a particular view by setting tools:ignore="MissingConstraints" to it or for all the views by setting that attribute for the parent ConstraintLayout but it isn't recommend.

easy_breezy
  • 1,073
  • 7
  • 18
0

They just fixed it in Android Studio 4.1 RC3 https://issuetracker.google.com/issues/79995034

Brook MG
  • 601
  • 10
  • 20
  • When you use gradle `lint` command (`gradlew :app:lint`) then even Android Gradle Plugin `4.2.0-beta04` doesn't work. I add this comment also in that issue – wrozwad Feb 03 '21 at 13:43
  • It's not fixed in Android Studio 4.1.2. [This](https://issuetracker.google.com/issues/79995034#comment3) comment in the IssueTracker thread implies it's fixed for Android Studio 4.2. I'll wait for the stable release of Android Studio 4.2 before trying it again and I'll keep my `tools:ignore="MissingConstraints"` declarations in place for now. – Adil Hussain Feb 05 '21 at 12:07