4

Same Application Work in Android 7 and Failed in Android 8.

On an activity i am retrieving data from Fire-base database. when Fire-base database is empty then no error occurred and error occurred when it's have data's , I searched error but never got any solution for that.

logcat :-

java.lang.IllegalArgumentException: path must be convex
        at android.graphics.Outline.setConvexPath(Outline.java:284)
        at android.graphics.drawable.AdaptiveIconDrawable.getOutline(AdaptiveIconDrawable.java:387)
        at android.view.ViewOutlineProvider$1.getOutline(ViewOutlineProvider.java:38)
        at android.view.View.rebuildOutline(View.java:14960)
        at android.view.View.setBackgroundBounds(View.java:19416)
        at android.view.View.drawBackground(View.java:19381)
        at android.view.View.draw(View.java:19183)
        at android.view.View.updateDisplayListIfDirty(View.java:18142)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.draw(View.java:19195)
        at android.view.View.updateDisplayListIfDirty(View.java:18142)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.support.v7.widget.RecyclerView.drawChild(RecyclerView.java:4703)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.draw(View.java:19195)
        at android.support.v7.widget.RecyclerView.draw(RecyclerView.java:4107)
        at android.view.View.updateDisplayListIfDirty(View.java:18142)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.draw(View.java:19195)
        at com.android.internal.policy.DecorView.draw(DecorView.java:788)
        at android.view.View.updateDisplayListIfDirty(View.java:18142)
        at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:669)
        at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:675)
        at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:783)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:2992)
        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2806)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2359)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
        at android.view.Choreographer.doCallbacks(Choreographer.java:723)

code of item_people.xml

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:weightSum="1"
        android:orientation="horizontal">

        <de.hdodenhof.circleimageview.CircleImageView
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/icon_avata"
            android:layout_width="0dp"
            android:layout_weight="0.15"
            android:layout_height="50dp"
            android:layout_margin="10dp"
            android:background="@mipmap/ic_launcher_round"
            app:civ_border_color="@color/colorPrimary" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginStart="10dp"
            android:layout_weight="0.8"
            android:orientation="vertical"
            android:layout_marginLeft="10dp"
            tools:ignore="RtlHardcoded">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:paddingTop="5dp">

                <TextView
                    android:id="@+id/people_name"
                    android:layout_width="0dp"
                    android:text="link"
                    android:layout_height="match_parent"
                    android:layout_weight="0.7"
                    android:gravity="center_vertical"
                    android:textAppearance="?android:attr/textAppearanceMedium" />

                <TextView
                    android:id="@+id/txtTime"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="0.3"
                    android:text=""
                    android:gravity="center_vertical|right"
                    android:paddingRight="10dp"
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    tools:ignore="RtlHardcoded,RtlSymmetry" />
            </LinearLayout>

            <TextView
                android:id="@+id/txtNickname"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="name"
                android:ellipsize="end"
                android:gravity="center_vertical"
                android:lines="1"
                android:paddingBottom="10dp"
                android:textAppearance="?android:attr/textAppearanceSmall" />
        </LinearLayout>
    </LinearLayout>
</android.support.v7.widget.CardView>
iamkdblue
  • 3,448
  • 2
  • 25
  • 43

2 Answers2

7

Looking at the stack trace, the first few lines tell a story:

java.lang.IllegalArgumentException: path must be convex
        at android.graphics.Outline.setConvexPath(Outline.java:284)
        at android.graphics.drawable.AdaptiveIconDrawable.getOutline(AdaptiveIconDrawable.java:387)
        at android.view.ViewOutlineProvider$1.getOutline(ViewOutlineProvider.java:38)
        at android.view.View.rebuildOutline(View.java:14960)
        at android.view.View.setBackgroundBounds(View.java:19416)
        at android.view.View.drawBackground(View.java:19381)
  • 3rd line mentions AdaptiveIconDrawable
  • 7th line mentions View.drawBackground()

Searching for AdaptiveIconDrawable tells us that this is a new Android 8 feature:

That explains why your code works on Android 7 but crashes on 8. On Android 7 the system does not use adaptive icons, but instead uses a normal PNG. On Android 8 it will use an adaptive icon if you have supplied one.

There seems to be something wrong with the new icon, or it just doesn't work where you are using it.


Next we need to find out what background is breaking...

Looking at your CardView layout, you are setting your launcher icon (on Android 8 this is likely to be your AdaptiveIconDrawable) onto your CircleImageView background.

That is where the crash is happening - either the icon is not valid, or CircleImageView does not support it when used this way.

A fix would be to include a PNG icon in your app that will work as the background in this case.

Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255
  • I haven't tried it yet, but I think the problem may be in this line: android:background="@mipmap/ic_launcher_round. Çözümü de @drawable/image.png – serif Jun 14 '22 at 05:44
2

Assuming your icon is set up properly, try setting the icon for CircleImageView using android:src instead of android:background.

JCSHoosier
  • 31
  • 4