Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google pre-launch report - Multiple items have the same description

Google now provides a 'Pre-Launch Report' when a new Beta version of an app is uploaded to the Play Store. My last Pre-Launch reports contained a complete dialog full of 'Multiple items have the same description'. I have now found out what, in my case, caused the problem and my solution. A simplified layout for my dialog that still showed the problem is the following:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:layout_height="fill_parent">
   <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical">
      <LinearLayout
         android:id="@+id/displayHeightLayout"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal">
         <TextView
            android:id="@+id/displayHeightLbl"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="@string/displayInfoEms"
            android:labelFor="@id/displayHeight"
            android:text="@string/displayHeightLbl" />
        <TextView
                android:id="@+id/displayHeight"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ems="@string/displayInfoEms" />
      </LinearLayout>
      <Button
         android:id="@+id/displayInfoOkBtn"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:onClick="dismissDisplayInfos"
         android:text="@string/btnOk" />
   </LinearLayout>
</ScrollView>

Google documentation suggested installing TalkBack and Accessibility Scanner, which enabled me to test and reproduce the problem. The solution is documented below.

like image 831
David Singleton Avatar asked Apr 19 '26 17:04

David Singleton


1 Answers

The solution lay in adding

android:importantForAccessibility="no"

to the definition of the second TextView, as follows:

        <TextView
                android:id="@+id/displayHeight"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:importantForAccessibility="no"
                android:ems="@string/displayInfoEms" />

I assume that the reason for the report is that the first TextView contains an android:labelFor attribute, referring to the second TextView, and that the Accessibility Scanner looks at both and thinks that the descriptions are the same. Is this a bug in the Accessibility Scanner?

like image 151
David Singleton Avatar answered Apr 21 '26 07:04

David Singleton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!