ChuckerTeam/chucker

Broken layout after updating version to 3.5.2

alexandroschar opened this issue ยท 3 comments

โœ๏ธ Describe the bug

After updating the library to 3.5.2 with compile and target SDK set to 31, multiple layouts in the app started to misplace some items, ignore paddings and margins, etc.

๐Ÿ’ฃ Steps to reproduce

  1. Create a new project and chucker dependency 3.5.2
  2. Add ConstraintLayout with following xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="@color/teal_200"
    android:paddingTop="@dimen/keyline_16"
    android:paddingHorizontal="@dimen/keyline_16">

  <ImageView
      android:id="@+id/image_view_1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent"
      android:src="@drawable/ic_android_black_24dp" />

  <TextView
      android:id="@+id/text_view_1"
      android:layout_width="0dp"
      android:layout_height="wrap_content"
      android:textColor="@color/oxford_blue"
      android:text="testing"
      android:layout_marginHorizontal="@dimen/keyline_8"
      app:layout_constraintStart_toEndOf="@id/image_view_1"
      app:layout_constraintEnd_toStartOf="@id/iamge_view_2"
      app:layout_constraintTop_toBottomOf="@id/image_view_1"
      app:layout_constraintBottom_toTopOf="@id/image_view_1" />

  <ImageView
      android:id="@+id/iamge_view_2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginEnd="@dimen/keyline_4"
      android:src="@drawable/rebranded_person"
      app:layout_constraintTop_toBottomOf="@id/image_view_1"
      app:layout_constraintBottom_toTopOf="@id/image_view_1"
      app:layout_constraintEnd_toStartOf="@id/text_view_2"
      app:tint="@color/black" />

  <TextView
      android:id="@+id/text_view_2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textColor="@color/black"
      android:text="12"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintTop_toBottomOf="@id/image_view_1"
      app:layout_constraintBottom_toTopOf="@id/image_view_1"/>

  <View
      android:id="@+id/seaprator"
      android:layout_width="match_parent"
      android:layout_height="2dp"
      app:layout_constraintStart_toStartOf="parent"
      android:background="@drawable/divider_horizontal"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintTop_toBottomOf="@id/image_view_1"
      android:layout_marginTop="@dimen/keyline_16"/>
</androidx.constraintlayout.widget.ConstraintLayout>
  1. Run the app

๐Ÿ”ง Expected behavior

See screenshots below.

๐Ÿ“ท Screenshots

Without chucker dependency:
Screen Shot 2022-04-18 at 12 22 34 PM

With chucker dependency:
Screen Shot 2022-04-18 at 12 23 07 PM

๐Ÿ“ฑ Tech info

  • Device: Pixel 3a
  • OS: 12
  • Chucker version: 3.5.2

๐Ÿ“„ Additional context

A new test project was created with just the default dependencies in order to make it easier to reproduce.

A new test project was created with just the default dependencies in order to make it easier to reproduce.

Could you share the reproducer?

I've looked into this, and the issue seems to be that you're using a older version of ConstraintLayout. If you update to 2.x you won't face this issue anymore.

Otherwise you can exclude the transitive dependency with:

implementation('com.github.chuckerteam.chucker:library:3.5.2') {
    exclude group: "androidx.constraintlayout"
}