I'm new to android developing and I've been facing some problems on adding this library to my project. I'm using android studio flamingo 2022. When I execute the app I end up getting the error log:
java.lang.RuntimeException: Unable to start activity ComponentInfo{app.project.jabayo/app.project.jabayo.activity.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3909) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4055) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) 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:2415) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:211) at android.os.Looper.loop(Looper.java:300) at android.app.ActivityThread.main(ActivityThread.java:8395) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference at com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx.getBottomNavigationItemViews(BottomNavigationViewEx.java:569) at com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx.enableAnimation(BottomNavigationViewEx.java:341) at app.project.jabayo.activity.MainActivity.bottomNavigationViewConfig(MainActivity.java:66) at app.project.jabayo.activity.MainActivity.onCreate(MainActivity.java:43) at android.app.Activity.performCreate(Activity.java:8538) at android.app.Activity.performCreate(Activity.java:8502) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1440) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3890) ... 12 more
The line 21 of my file bottom_navigation.xml calls the bottom navigation menu, like this:
app:menu="@menu/menu_bottom_navigation" />
The file menu_bottom_navigation.xml only contains the icons for the bottom navigation bar.
I checked the BottomNavigationViewEX.java file and it didn't have any error but the BottomNavitagionViewInner.java had the "Library source does not match the bytecode for class BottomNavigationViewInner" error.
I also couldn't find the com.google.android.material.R$styleable class.
I belive the problem can be related to the 'com.google.android.material:material:1.5.0' implementation. These are my build.gradle (app) dependencies:
`dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation 'androidx.navigation:navigation-fragment:2.5.3'
implementation 'androidx.navigation:navigation-ui:2.5.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
/*Firebase*/
implementation platform('com.google.firebase:firebase-bom:32.1.1')
implementation 'com.google.firebase:firebase-database'
implementation 'com.google.firebase:firebase-storage'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-analytics'
/*bottom navigation*/
implementation 'com.github.ittianyu:BottomNavigationViewEx:2.0.4'
}`
And my setting.gradle:
pluginManagement { repositories { google() mavenCentral() gradlePluginPortal() } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() maven { url "https://jitpack.io" } maven { url "https://maven.google.com" } } } rootProject.name = "Jabayo" include ':app'
I apologize if my question is a bit confusing, I really am new to this.
I'm new to android developing and I've been facing some problems on adding this library to my project. I'm using android studio flamingo 2022. When I execute the app I end up getting the error log:
java.lang.RuntimeException: Unable to start activity ComponentInfo{app.project.jabayo/app.project.jabayo.activity.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3909) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4055) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) 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:2415) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:211) at android.os.Looper.loop(Looper.java:300) at android.app.ActivityThread.main(ActivityThread.java:8395) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference at com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx.getBottomNavigationItemViews(BottomNavigationViewEx.java:569) at com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx.enableAnimation(BottomNavigationViewEx.java:341) at app.project.jabayo.activity.MainActivity.bottomNavigationViewConfig(MainActivity.java:66) at app.project.jabayo.activity.MainActivity.onCreate(MainActivity.java:43) at android.app.Activity.performCreate(Activity.java:8538) at android.app.Activity.performCreate(Activity.java:8502) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1440) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3890) ... 12 moreThe line 21 of my file
bottom_navigation.xmlcalls the bottom navigation menu, like this:app:menu="@menu/menu_bottom_navigation" />The file
menu_bottom_navigation.xmlonly contains the icons for the bottom navigation bar.I checked the
BottomNavigationViewEX.javafile and it didn't have any error but theBottomNavitagionViewInner.javahad the "Library source does not match the bytecode for class BottomNavigationViewInner" error.I also couldn't find the
com.google.android.material.R$styleableclass.I belive the problem can be related to the
'com.google.android.material:material:1.5.0'implementation. These are my build.gradle (app) dependencies:`dependencies {
}`
And my setting.gradle:
pluginManagement { repositories { google() mavenCentral() gradlePluginPortal() } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() maven { url "https://jitpack.io" } maven { url "https://maven.google.com" } } } rootProject.name = "Jabayo" include ':app'I apologize if my question is a bit confusing, I really am new to this.