Error inflating class de.hdodenhof.circleimageview.CircleImageView in Android version 6 marshmallow

I also faced the same issue having width and height is "dp". But, on my side it resolves by replacing scaleType from fitcenter to centerCrop.


CHange this:

<de.hdodenhof.circleimageview.CircleImageView
        android:id="@+id/civ_requests"
        android:layout_width="80sp"
        android:layout_height="80sp"
        android:layout_margin="10sp"
        android:src="@drawable/profilesvg" />

to this:

<de.hdodenhof.circleimageview.CircleImageView
        android:id="@+id/civ_requests"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_margin="10dp"
        android:src="@drawable/profilesvg" />

You're suppose to use SP only in fontSize. For layout height and width as well as margins the unit should be DP.

And with this make sure your source image is in drawable and not in drawablev24.


In my case I had this error, because I had adjustViewBounds="true" in my layout. Removing it fixed the problem.