E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.hyeonwoo.art_android, PID: 26068
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hyeonwoo.art_android/com.hyeonwoo.art_android.ui.main.MainActivity}: android.view.InflateException: Binary XML file line #35 in com.hyeonwoo.art_android:layout/activity_main: Binary XML file line #35 in com.hyeonwoo.art_android:layout/activity_main: Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3654)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3806)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
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:2267)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8167)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Caused by: android.view.InflateException: Binary XML file line #35 in com.hyeonwoo.art_android:layout/activity_main: Binary XML file line #35 in com.hyeonwoo.art_android:layout/activity_main: Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView
Caused by: android.view.InflateException: Binary XML file line #35 in com.hyeonwoo.art_android:layout/activity_main: Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView
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:854)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:710)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:303)
at androidx.databinding.DataBindingUtil.setContentView(DataBindingUtil.java:284)
at com.hyeonwoo.art_android.ui.BaseActivity.onCreate(BaseActivity.kt:15)
at com.hyeonwoo.art_android.ui.main.MainActivity.onCreate(MainActivity.kt:16)
at android.app.Activity.performCreate(Activity.java:7963)
at android.app.Activity.performCreate(Activity.java:7952)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3629)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3806)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
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:2267)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8167)
at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f0601ea
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:276)
at android.content.res.Resources.getValue(Resources.java:1452)
at androidx.core.content.res.ResourcesCompat.isColorInt(ResourcesCompat.java:309)
at androidx.core.content.res.ResourcesCompat.inflateColorStateList(ResourcesCompat.java:256)
at androidx.core.content.res.ResourcesCompat.getColorStateList(ResourcesCompat.java:236)
at androidx.core.content.ContextCompat.getColorStateList(ContextCompat.java:519)
at androidx.appcompat.content.res.AppCompatResources.getColorStateList(AppCompatResources.java:48)
at androidx.appcompat.widget.TintTypedArray.getColorStateList(TintTypedArray.java:179)
at com.google.android.material.navigation.NavigationBarView.<init>(NavigationBarView.java:168)
at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:108)
at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:103)
at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:98)
... 31 more
I/Process: Sending signal. PID: 26068 SIG: 9
AVD 장치에서는 오류가 없었는데, 실제 장치에서 실행 시 activity를 띄우는 도중 크래시가 발생했다 ㅠ
정확한 원인은 잘 모르겠지만, 오류 로그를 통해 문제가 발생하는 지점이 BottomNavigationView 라는걸 알수있었음!
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/main_bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemBackground="@color/white"
app:itemIconTint="@color/material_dynamic_tertiary50"
app:itemTextColor="@color/black"
app:menu="@menu/menus" />
수상해 보이는 건 메뉴 아니면 머테리얼 컬러인것 같아서 컬러 값을 변경해보니 정상 동작했다...
해당 material color의 실제 색상 Hex값으로 수정 후 실행하니 크래시가 발생하지 않았음 ~
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/main_bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#CAC1EA"
app:itemBackground="@color/white"
app:itemIconTint="#FF787296"
app:itemTextColor="@color/black"
app:menu="@menu/menus" />
더 좋은 방법있음 댓글 달아주쇼~