Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textColorSecondary issue #226

Closed
dmytroivanovv opened this issue Nov 6, 2018 · 3 comments
Closed

textColorSecondary issue #226

dmytroivanovv opened this issue Nov 6, 2018 · 3 comments

Comments

@dmytroivanovv
Copy link

Hi.
I migrated to AndroidX. Then i decided use material components. My steps:

  1. AppTheme from appcompat changed to Theme.MaterialComponents.Light.NoActionBar.Bridge
  2. All my activities extends from AppCompatActivity.
    Everythings fine, with textinput, and etc. But i have a problem with com.google.android.material.bottomnavigation.BottomNavigationView.
    11-06 14:40:10.249 26879-26879/ru.studymate.smandroid E/AndroidRuntime: FATAL EXCEPTION: main Process: ru.studymate.smandroid, PID: 26879 java.lang.RuntimeException: Unable to start activity ComponentInfo{ru.studymate.smandroid/ru.studymate.smandroid.presentation.screen.main.MainActivity}: android.view.InflateException: Binary XML file line #28: Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Caused by: android.view.InflateException: Binary XML file line #28: Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView at android.view.LayoutInflater.createView(LayoutInflater.java:621) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697) at android.view.LayoutInflater.rInflate(LayoutInflater.java:756) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290) at android.app.Activity.setContentView(Activity.java:1929) at ru.studymate.smandroid.presentation.screen.main.MainActivity.onCreate(MainActivity.kt:19) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)  at android.app.ActivityThread.access$800(ActivityThread.java:135)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5017)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.createView(LayoutInflater.java:595) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)  at android.app.Activity.setContentView(Activity.java:1929)  at ru.studymate.smandroid.presentation.screen.main.MainActivity.onCreate(MainActivity.kt:19)  at android.app.Activity.performCreate(Activity.java:5231)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)  at android.app.ActivityThread.access$800(ActivityThread.java:135)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5017)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)  at dalvik.system.NativeStart.main(Native Method)  Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0 at android.content.res.Resources.getValue(Resources.java:1123) at androidx.appcompat.content.res.AppCompatResources.isColorInt(AppCompatResources.java:163) at androidx.appcompat.content.res.AppCompatResources.inflateColorStateList(AppCompatResources.java:110) at androidx.appcompat.content.res.AppCompatResources.getColorStateList(AppCompatResources.java:76) at com.google.android.material.bottomnavigation.BottomNavigationMenuView.createDefaultColorStateList(BottomNavigationMenuView.java:467) at com.google.android.material.bottomnavigation.BottomNavigationMenuView.<init>(BottomNavigationMenuView.java:101) at com.google.android.material.bottomnavigation.BottomNavigationMenuView.<init>(BottomNavigationMenuView.java:86) at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:123) at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:114) at java.lang.reflect.Constructor.constructNative(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  at android.view.LayoutInflater.createView(LayoutInflater.java:595)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:756)  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)  at android.app.Activity.setContentView(Activity.java:1929)  at ru.studymate.smandroid.presentation.screen.main.MainActivity.onCreate(MainActivity.kt:19)  at android.app.Activity.performCreate(Activity.java:5231)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)  at android.app.ActivityThread.access$800(ActivityThread.java:135)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5017)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)  at dalvik.system.NativeStart.main(Native Method) 
    Then and tried to fix exception, and i found when in my style, when i comment out the line
    <item name="android:textColorSecondary">#000</item>
    Problems gone.
    What did i wrong?
@poldz123
Copy link

poldz123 commented Nov 7, 2018

Material component does not accept raw value within the theme. Thus why you are getting an error.

android.content.res.Resources$NotFoundException: Resource ID #0x0 at 

To fix this you need to have a reference of the colors within your colors.xml in the theme attributes

@dmytroivanovv
Copy link
Author

Material component does not accept raw value within the theme. Thus why you are getting an error.

android.content.res.Resources$NotFoundException: Resource ID #0x0 at 

To fix this you need to have a reference of the colors within your colors.xml in the theme attributes

Exactly. Thanks.

@gsajith
Copy link
Contributor

gsajith commented Nov 9, 2018

Seems like this is resolved -- closing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants