ethanhua / Skeleton

A library provides an easy way to show skeleton loading view like Facebook and Alipay
3.68k stars 457 forks source link

RecyclerView skeleton screen is crashing app when shimmer_color is not defined #13

Closed pgreze closed 6 years ago

pgreze commented 6 years ago

Version: 1.1.0

AndroidRuntime: java.lang.NoSuchFieldError: No static field shimmer_color of type I in class Lcom/ethanhua/skeleton/R$color; or its superclasses (declaration of 'com.ethanhua.skeleton.R$color' appears in /data/app/io.zla.app.dev-Vy5HPDU23Z-PLz_xYaxCWw==/base.apk!classes3.dex)
AndroidRuntime:     at com.ethanhua.skeleton.RecyclerViewSkeletonScreen$Builder.<init>(RecyclerViewSkeletonScreen.java:62)
AndroidRuntime:     at com.ethanhua.skeleton.Skeleton.bind(Skeleton.java:13)
ethanhua commented 6 years ago

@pgreze I think you have also a resource color called shimmer_color and it's causing conflicts with Skeleton with the same name.

pgreze commented 6 years ago

@ethanhua If I remember correctly, this issue happened after I renamed my shimmer_color to shimmer. I think it's showing than https://github.com/ethanhua/Skeleton/blob/master/library/src/main/java/com/ethanhua/skeleton/RecyclerViewSkeletonScreen.java#L62 is relying on Android weird resources fallbacks, leading to an unstable user experience.

I don't have a specific fix to advise but I finally decided to fork your good library into my project, in order to avoid similar unwritten defaults. Thanks for your hard work, especially your recycler view binder.

shivangbtech commented 4 years ago

I am using data binding and for recycler view I am using the collection adapter library: https://github.com/evant/binding-collection-adapter

Getting error:

java.lang.ClassCastException: com.ethanhua.skeleton.SkeletonAdapter cannot be cast to me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter at me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapters.setAdapter(BindingRecyclerViewAdapters.java:19) at com.coroutinedemo.databinding.FragmentTodoListBindingImpl.executeBindings(FragmentTodoListBindingImpl.java:209)

please help to get rid of it.