找不到类'android.graphics.drawable.RippleDrawable

时间:2017-01-21 19:07:53

标签: android android-layout

Android应用程序意外关闭并在log-cat中发出以下错误。

01-22 00:33:58.470 8193-8193/? E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
01-22 00:34:00.010 1173-1173/? E/MyTag: updateClock : 12:34
01-22 00:34:00.015 1173-1173/? E/MyTag: updateClock : 12:34 AM
01-22 00:34:00.051 1173-1173/? E/MyTag: updateClock : 12:34 AM
01-22 00:34:00.080 1432-1432/? E/ActionIcon: time changed: time = 20170122T003400Asia/Calcutta(0,21,19800,0,1485025440)
01-22 00:34:00.086 8210-8210/? E/Zygote: Zygote:  error closing descriptor
                                         libcore.io.ErrnoException: close failed: EBADF (Bad file number)
                                             at libcore.io.Posix.close(Native Method)
                                             at libcore.io.BlockGuardOs.close(BlockGuardOs.java:75)
                                             at com.android.internal.os.ZygoteInit.closeServerSocket(ZygoteInit.java:221)
                                             at com.android.internal.os.ZygoteConnection.handleChildProc(ZygoteConnection.java:879)
                                             at com.android.internal.os.ZygoteConnection.runOnce(ZygoteConnection.java:242)
                                             at com.android.internal.os.ZygoteInit.runSelectLoop(ZygoteInit.java:713)
                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:649)
                                             at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:2)

对我来说,问题是color-selector drawable我用于tint的{​​{1}}值。崩溃发生在 API 19 (我假设它在所有设备API< 21上)。

有问题的代码

ImageView

color_bottom_navigation_item.xml

<ImageView
    android:id="@+id/icon"
    android:layout_width="24dp"
    android:layout_height="24dp"
    android:layout_gravity="center"
    android:src="@drawable/ic_music_note_white_24dp"
    android:tint="@color/color_bottom_navigation_item" />

解决方案

从XML中删除<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:color="#00CCF0" android:state_selected="true" /> <item android:color="#75848C" /> </selector> 属性并以编程方式设置它:

android:tint