eluleci / FlatUI

Android FlatUI Kit
1.67k stars 423 forks source link

Inflate exception for Seekbar on Android L #24

Closed robisaks closed 9 years ago

robisaks commented 10 years ago

Appears to be an incorrect cast

Caused by: java.lang.ClassCastException: android.graphics.drawable.StateListDrawable cannot be cast to android.graphics.drawable.LayerDrawable

https://github.com/eluleci/FlatUI/blob/master/library/src/main/java/com/cengalabs/flatui/views/FlatSeekBar.java#L83

<com.cengalabs.flatui.views.FlatSeekBar
                    flatui:theme="@array/snow"
                    android:id="@+id/font_size"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:max="40"
                    />
07-15 14:20:49.762  15298-15298/com.snap E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.snap, PID: 15298
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.snap/com.snap.DragAndDrop}: android.view.InflateException: Binary XML file line #179: Error inflating class com.cengalabs.flatui.views.FlatSeekBar
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2255)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2317)
            at android.app.ActivityThread.access$800(ActivityThread.java:143)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5070)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
     Caused by: android.view.InflateException: Binary XML file line #179: Error inflating class com.cengalabs.flatui.views.FlatSeekBar
            at android.view.LayoutInflater.createView(LayoutInflater.java:629)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:739)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:802)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:805)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:805)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:805)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:500)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:410)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:361)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:350)
            at android.app.Activity.setContentView(Activity.java:2122)
            at com.snap.DragAndDrop.onCreate(DragAndDrop.java:112)
            at android.app.Activity.performCreate(Activity.java:5720)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1102)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2208)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2317)
            at android.app.ActivityThread.access$800(ActivityThread.java:143)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5070)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
     Caused by: java.lang.reflect.InvocationTargetException
            at java.lang.reflect.Constructor.newInstance(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
            at android.view.LayoutInflater.createView(LayoutInflater.java:603)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:739)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:802)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:805)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:805)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:805)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:500)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:410)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:361)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:350)
            at android.app.Activity.setContentView(Activity.java:2122)
            at com.snap.DragAndDrop.onCreate(DragAndDrop.java:112)
            at android.app.Activity.performCreate(Activity.java:5720)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1102)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2208)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2317)
            at android.app.ActivityThread.access$800(ActivityThread.java:143)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5070)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
     Caused by: java.lang.ClassCastException: android.graphics.drawable.StateListDrawable cannot be cast to android.graphics.drawable.LayerDrawable
            at com.cengalabs.flatui.views.FlatSeekBar.init(FlatSeekBar.java:83)
            at com.cengalabs.flatui.views.FlatSeekBar.<init>(FlatSeekBar.java:31)
            at java.lang.reflect.Constructor.newInstance(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
            at android.view.LayoutInflater.createView(LayoutInflater.java:603)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:739)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:802)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:805)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:805)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:805)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:500)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:410)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:361)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:350)
            at android.app.Activity.setContentView(Activity.java:2122)
            at com.snap.DragAndDrop.onCreate(DragAndDrop.java:112)
            at android.app.Activity.performCreate(Activity.java:5720)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1102)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2208)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2317)
            at android.app.ActivityThread.access$800(ActivityThread.java:143)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5070)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:631)
eluleci commented 9 years ago

I installed Android L today and checked it. Everything seems working to me. I had no exceptions. You know L is not reliable yet. So this problem may not be library's problem, may be caused by L.

capur16 commented 9 years ago

On nexus 5 with stable android L, I have same exception.

eluleci commented 9 years ago

Since that L Preview is not a stable version these kind of errors may happen and it is not the problem of the library. I am closing this issue because Lollipop is released and there is no such error in that stable version.

michalbrz commented 9 years ago

I have the same problem with official Lollipop 5.0.1. Just created a sample app to try if this is really a problem with Android L or my own project. Only creating auto-generated app and adding FlatUI's SeekBar works. BUT when you change project's theme to some theme from latest AppCompat (v7), for example Theme.AppCompat.Light.NoActionBar, then exception occurs. So FlatUI doesn't play well with AppCompat.

anikievev commented 8 years ago

There is the same issue on Xperia Z3 with android L. Do you have any idea how to fix that ?

chenxinxun commented 7 years ago

The same issue on sony z3 android 5.0.2