Droppers / AnimatedBottomBar

A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.
MIT License
1.37k stars 109 forks source link

Resource Not Found Exception #0xff00668b #68

Open alijafari-gd opened 1 year ago

alijafari-gd commented 1 year ago

I used the library in my app, and it works great on my phone with android 13 , but when i try to install it on other android devices , it crashes with this same error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aliJafari.wakee2/com.aliJafari.wakee.MainActivity}: android.view.InflateException: Binary XML file line #46 in com.aliJafari.wakee2:layout/activity_main: Binary XML file line #46 in com.aliJafari.wakee2:layout/activity_main: Error inflating class nl.joery.animatedbottombar.AnimatedBottomBar
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3547)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3719)
 at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
 at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
 at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2154)
 at android.os.Handler.dispatchMessage(Handler.java:106)
 at android.os.Looper.loop(Looper.java:236)
 at android.app.ActivityThread.main(ActivityThread.java:8107)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
Caused by: android.view.InflateException: Binary XML file line #46 in com.aliJafari.wakee2:layout/activity_main: Binary XML file line #46 in com.aliJafari.wakee2:layout/activity_main: Error inflating class nl.joery.animatedbottombar.AnimatedBottomBar
Caused by: android.view.InflateException: Binary XML file line #46 in com.aliJafari.wakee2:layout/activity_main: Error inflating class nl.joery.animatedbottombar.AnimatedBottomBar
Caused by: java.lang.reflect.InvocationTargetException
 at java.lang.reflect.Constructor.newInstance0(Native Method)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
 at android.view.LayoutInflater.createView(LayoutInflater.java:856)
 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1008)
 at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:963)
 at android.view.LayoutInflater.rInflate(LayoutInflater.java:1125)
 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1086)
 at android.view.LayoutInflater.rInflate(LayoutInflater.java:1128)
 at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1086)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:684)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:536)
 at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
 at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:775)
 at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:197)
 at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:303)
 at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284)
 at com.aliJafari.wakee.MainActivity.onCreate(MainActivity.kt:123)
 at android.app.Activity.performCreate(Activity.java:8157)
 at android.app.Activity.performCreate(Activity.java:8129)
 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1310)
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3520)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3719)
 at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
 at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
 at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2154)
 at android.os.Handler.dispatchMessage(Handler.java:106)
 at android.os.Looper.loop(Looper.java:236)
 at android.app.ActivityThread.main(ActivityThread.java:8107)
at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0xff00668b
 at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:239)
 at android.content.res.MiuiResourcesImpl.getValue(MiuiResourcesImpl.java:96)
 at android.content.res.Resources.getColor(Resources.java:1076)
 at android.content.Context.getColor(Context.java:686)
 at androidx.core.content.ContextCompat$Api23Impl.getColor(ContextCompat.java:1034)
 at androidx.core.content.ContextCompat.getColor(ContextCompat.java:578)
 at nl.joery.animatedbottombar.utils.ExtensionsKt.getColorResCompat(Extensions.kt:14)
 at nl.joery.animatedbottombar.AnimatedBottomBar.initAttributes(AnimatedBottomBar.kt:65)
 at nl.joery.animatedbottombar.AnimatedBottomBar.<init>(AnimatedBottomBar.kt:54)
 at nl.joery.animatedbottombar.AnimatedBottomBar.<init>(AnimatedBottomBar.kt:31)
 at nl.joery.animatedbottombar.AnimatedBottomBar.<init>(Unknown Source:6)
 ... 32 more
Lemou-Memo commented 2 months ago

This is not about AndroidX. I created a new project and implemented the library via Gradle. Everything was perfect. Also, I reproduced your crash.

If you create tab item following everything is fine:

<tab
    drawable="@drawable/ic_home_black_24dp"
    text="@string/home" />

But if you create like this:

<tab
    drawable="@drawable/ic_home_black_24dp"
    text="Home" />

It throws the error. Please recheck your tabs file.