Plugin broken with material:1.4.0-alpha01
MoaazElneshawy opened this issue · comments
first of all , I like your library .. it's amazing and depending on android BottomNavigationView is great and useful
I try to use it , but I got an error ..
java.lang.NullPointerException: firstElement must not be null
at com.github.kwasow.bottomnavigationcircles.BottomNavigationCircles.selectFirstItem(BottomNavigationCircles.kt:107)
at com.github.kwasow.bottomnavigationcircles.BottomNavigationCircles.init(BottomNavigationCircles.kt:57)
at com.github.kwasow.bottomnavigationcircles.BottomNavigationCircles.(BottomNavigationCircles.kt:44)
------------
my xml file
<com.github.kwasow.bottomnavigationcircles.BottomNavigationCircles
android:id="@+id/bottomNav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:backgroundTint="@color/appDarkRed"
app:itemBackground="@color/appDarkGreen"
app:itemIconTint="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:menu="@menu/bottom_nav_menu" />
Could you attach the menu xml file as well?
<item
android:id="@+id/navigationHome"
android:contentDescription="@string/home_home"
android:icon="@drawable/ic_home"
android:title="@string/home_home" />
<item
android:id="@+id/navigationMeals"
android:contentDescription="@string/home_meals"
android:icon="@drawable/ic_meals"
android:title="@string/home_meals" />
<item
android:id="@+id/navigationQr"
android:contentDescription="@string/home_qr"
android:icon="@drawable/ic_qr_code"
android:title="@string/home_qr" />
<item
android:id="@+id/navigationPackages"
android:contentDescription="@string/home_packages"
android:icon="@drawable/ic_packages"
android:title="@string/home_packages" />
<item
android:id="@+id/navigationMore"
android:contentDescription="@string/home_more"
android:icon="@drawable/ic_more"
android:title="@string/home_more" />
Try depending on the new commit and let me know if it's fixed.
dependencies {
implementation 'com.github.Kwasow:BottomNavigationCircles-Android:c7b40feef9'
}
I'll do a new release if it is fixed.
the same ..
java.lang.NullPointerException: firstElement must not be null
at com.github.kwasow.bottomnavigationcircles.BottomNavigationCircles.selectFirstItem(BottomNavigationCircles.kt:116)
at com.github.kwasow.bottomnavigationcircles.BottomNavigationCircles.onAttachedToWindow(BottomNavigationCircles.kt:60)
at android.view.View.dispatchAttachedToWindow(View.java:19553)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3430)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2028)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1721)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7598)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966)
at android.view.Choreographer.doCallbacks(Choreographer.java:790)
at android.view.Choreographer.doFrame(Choreographer.java:725)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
What are the operations you perform on the view in you code?
'com.github.Kwasow:BottomNavigationCircles-Android:c7b40feef9'
I mean do you do something to the view in your activity in java/kotlin?
nothing at all , my activity is empty and here's my xml
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@id/bottomNav"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/mobile_navigation"
tools:ignore="FragmentTagUsage" />
<com.github.kwasow.bottomnavigationcircles.BottomNavigationCircles
android:id="@+id/bottomNav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:backgroundTint="@color/appDarkRed"
app:itemBackground="@color/appDarkGreen"
app:itemIconTint="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:menu="@menu/bottom_nav_menu" />
</androidx.constraintlayout.widget.ConstraintLayout>
The issue seems to be that the navigation view can't find the icon view on the first element. I've moved the layout listener to it's parent so maybe it won't cause any issues now. Please try com.github.Kwasow:BottomNavigationCircles-Android:7d1a269ca6
I got it. You are using com.google.android.material:material:1.3.0 which has com.google.android.material.bottomnavigation.BottomNavigationItemView as a public
but we are using latest version com.google.android.material:material:1.4.0-alpha01 which has BottomNavigationItemView as private
Yep, seems that updating to 1.4.0-alpha01 does also cause issues on my builds. Thanks for the details, I'll see what I can do anyways
I think you should wait for a stable release of material because alpha releases api can be changed in coming release.
You can just advice users not to update material library for now
I'll keep it on a separate branch and merge when it goes stable.
I've coded an update for the alpha update on the material-1.4.0-alpha1
branch.
If you need it you can try it out with:
implementation 'com.github.Kwasow:BottomNavigationCircles-Android:material-1.4.0-alpha1-SNAPSHOT'
(which will always download the latest commit)
or
implementation 'com.github.Kwasow:BottomNavigationCircles-Android:material-1.4.0-alpha1-fb1570a749-1
(current latest commit)