java.lang.RuntimeException: Unable to start activity ComponentInfo{test.android/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable

Appcelerator JIRA | Fokke Zandbergen | 1 year ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    The following sample demonstrates that the app crashes when you use both the {{backgroundColor}} and {{cardCornerRadius}} property on a CardView. If you use {{cardBackgroundColor}} instead it works. {code:javascript} var win = Ti.UI.createWindow(); var card = Ti.UI.Android.createCardView({ top: 20, left: 20, right: 20, contentPadding: 20, // Remove and it won't crash cardCornerRadius: 20, // Rename to cardBackgroundColor and it won't crash backgroundColor: '#F00' }); card.add(Ti.UI.createLabel({ text: 'Hello, world!', color: '#000' })); win.add(card); win.open(); {code} *Logs* {code} [ERROR] TiApplication: (main) [478,478] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{test.android/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable; Titanium 5.1.0,2015/10/26 16:46,c914b0f [ERROR] TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{test.android/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable [ERROR] TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) [ERROR] TiApplication: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) [ERROR] TiApplication: at android.app.ActivityThread.access$800(ActivityThread.java:151) [ERROR] TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) [ERROR] TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102) [ERROR] TiApplication: at android.os.Looper.loop(Looper.java:135) [ERROR] TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5254) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Native Method) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Method.java:372) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) [ERROR] TiApplication: Caused by: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable [ERROR] TiApplication: at android.support.v7.widget.CardViewApi21.setRadius(CardViewApi21.java:36) [ERROR] TiApplication: at android.support.v7.widget.CardView.setRadius(CardView.java:281) [ERROR] TiApplication: at ti.modules.titanium.ui.widget.TiUICardView.processProperties(TiUICardView.java:62) [ERROR] TiApplication: at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1209) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:505) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:496) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:474) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:512) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:496) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:474) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:675) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.jav [ERROR] TiApplication: at ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:237) [ERROR] TiApplication: at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:33) [ERROR] TiApplication: at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:501) [ERROR] TiApplication: at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:594) [ERROR] TiApplication: at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18) [ERROR] TiApplication: at android.app.Activity.performCreate(Activity.java:5990) [ERROR] TiApplication: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) [ERROR] TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) [ERROR] TiApplication: ... 10 more -- End application log ------------------------------------------------------- {code}

    Appcelerator JIRA | 1 year ago | Fokke Zandbergen
    java.lang.RuntimeException: Unable to start activity ComponentInfo{test.android/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable
  2. 0

    The following sample demonstrates that the app crashes when you use both the {{backgroundColor}} and {{cardCornerRadius}} property on a CardView. If you use {{cardBackgroundColor}} instead it works. {code:javascript} var win = Ti.UI.createWindow(); var card = Ti.UI.Android.createCardView({ top: 20, left: 20, right: 20, contentPadding: 20, // Remove and it won't crash cardCornerRadius: 20, // Rename to cardBackgroundColor and it won't crash backgroundColor: '#F00' }); card.add(Ti.UI.createLabel({ text: 'Hello, world!', color: '#000' })); win.add(card); win.open(); {code} *Logs* {code} [ERROR] TiApplication: (main) [478,478] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{test.android/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable; Titanium 5.1.0,2015/10/26 16:46,c914b0f [ERROR] TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{test.android/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable [ERROR] TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) [ERROR] TiApplication: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) [ERROR] TiApplication: at android.app.ActivityThread.access$800(ActivityThread.java:151) [ERROR] TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) [ERROR] TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102) [ERROR] TiApplication: at android.os.Looper.loop(Looper.java:135) [ERROR] TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5254) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Native Method) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Method.java:372) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) [ERROR] TiApplication: Caused by: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable [ERROR] TiApplication: at android.support.v7.widget.CardViewApi21.setRadius(CardViewApi21.java:36) [ERROR] TiApplication: at android.support.v7.widget.CardView.setRadius(CardView.java:281) [ERROR] TiApplication: at ti.modules.titanium.ui.widget.TiUICardView.processProperties(TiUICardView.java:62) [ERROR] TiApplication: at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1209) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:505) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:496) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:474) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:512) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:496) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:474) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:675) [ERROR] TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.jav [ERROR] TiApplication: at ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:237) [ERROR] TiApplication: at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:33) [ERROR] TiApplication: at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:501) [ERROR] TiApplication: at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:594) [ERROR] TiApplication: at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18) [ERROR] TiApplication: at android.app.Activity.performCreate(Activity.java:5990) [ERROR] TiApplication: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) [ERROR] TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) [ERROR] TiApplication: ... 10 more -- End application log ------------------------------------------------------- {code}

    Appcelerator JIRA | 1 year ago | Fokke Zandbergen
    java.lang.RuntimeException: Unable to start activity ComponentInfo{test.android/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable
  3. 0

    android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawableWithShadow

    Stack Overflow | 3 years ago | D4ddy-LiLd4rk
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.brobox.materialcolorpalette/com.brobox.materialcolorpalette.MainActivity}: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawableWithShadow
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable

      at android.support.v7.widget.CardViewApi21.setRadius()
    2. Android v7
      CardView.setRadius
      1. android.support.v7.widget.CardViewApi21.setRadius(CardViewApi21.java:36)
      2. android.support.v7.widget.CardView.setRadius(CardView.java:281)
      2 frames
    3. ti.modules.titanium
      TiUICardView.processProperties
      1. ti.modules.titanium.ui.widget.TiUICardView.processProperties(TiUICardView.java:62)
      1 frame
    4. org.appcelerator.kroll
      KrollProxy.setModelListener
      1. org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1209)
      1 frame
    5. org.appcelerator.titanium
      TiViewProxy.handleAdd
      1. org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:505)
      2. org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:496)
      3. org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:474)
      4. org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:512)
      5. org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:496)
      6. org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:474)
      7. org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:675)
      7 frames