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

UnsupportedOperationException : Crash - while trying to integrate the Bottombar sdk #241

Closed
praveeng145 opened this issue May 20, 2016 · 2 comments

Comments

@praveeng145
Copy link

praveeng145 commented May 20, 2016

Am using compile 'com.roughike:bottom-bar:1.3.3' version. Am integrating this sdk and I have the following three lines -

BottomBar bottomBar = BottomBar.attach(this, savedInstanceState); bottomBar.setItems(new BottomBarTab(getResources().getDrawable(R.drawable.icon), "Tab1") ,new BottomBarTab(getResources().getDrawable(R.drawable.icon), "Tab2") ,new BottomBarTab(getResources().getDrawable(R.drawable.icon), "Tab3"));

App is crashing with the following exception logs

FATAL EXCEPTION: main Process: com.mobile.client.android, PID: 12596 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mobile.client.android/com.mobile.client.android.ui.activities.DashboardActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class <unknown> at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2625) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2686) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:5969) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:801) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691) Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class <unknown> Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown> Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:430) at android.view.LayoutInflater.createView(LayoutInflater.java:645) at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) at android.view.LayoutInflater.inflate(LayoutInflater.java:495) at android.view.LayoutInflater.inflate(LayoutInflater.java:426) at android.view.LayoutInflater.inflate(LayoutInflater.java:377) at android.view.View.inflate(View.java:20808) at com.roughike.bottombar.BottomBar.updateItems(BottomBar.java:1195) at com.roughike.bottombar.BottomBar.setItems(BottomBar.java:309) at com.mobile.client.android.ui.activities.DashboardActivity.onCreate(DashboardActivity.java:60) at android.app.Activity.performCreate(Activity.java:6669) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2578) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2686) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:5969) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:801) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691) Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f010069 a=2} at android.content.res.TypedArray.getDrawable(TypedArray.java:921) at android.view.View.<init>(View.java:4174) at android.view.ViewGroup.<init>(ViewGroup.java:578) at android.widget.LinearLayout.<init>(LinearLayout.java:211) at android.widget.LinearLayout.<init>(LinearLayout.java:207) at android.widget.LinearLayout.<init>(LinearLayout.java:203) at java.lang.reflect.Constructor.newInstance0(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:430)  at android.view.LayoutInflater.createView(LayoutInflater.java:645)  at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)  at android.view.LayoutInflater.inflate(LayoutInflater.java:495)  at android.view.LayoutInflater.inflate(LayoutInflater.java:426)  at android.view.LayoutInflater.inflate(LayoutInflater.java:377)  at android.view.View.inflate(View.java:20808)  at com.roughike.bottombar.BottomBar.updateItems(BottomBar.java:1195)  at com.roughike.bottombar.BottomBar.setItems(BottomBar.java:309)  at com.mobile.client.android.ui.activities.DashboardActivity.onCreate(DashboardActivity.java:60)  at android.app.Activity.performCreate(Activity.java:6669)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2578)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2686)  at android.app.ActivityThread.-wrap12(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:5969)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:801)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691) 

@luxn
Copy link

luxn commented May 21, 2016

I've got the same problem.

I've used

bottomBar.setItemsFromMenu(R.menu.bottombar_menu, new OnMenuTabClickListener() {...});
and
bottomBar.setItems(new BottomBarTab(R.drawable.ic_chats, "Chats"), ...);

but both are resulting in the Error that @praveeng145 described. Im using Android Studio 2.2 Preview 1 and bottom-bar v1.3.3

@praveeng145
Copy link
Author

praveeng145 commented May 21, 2016

@luxn and @teamBottomBar I am able to fix the issue. The issue is because my activity is missing a style extended from Theme.AppCompat.*

I added the following style to my activity and it worked.
<style name="BottomBarTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">#2196F3</item> <item name="colorPrimaryDark">#1565C0</item> <item name="colorAccent">#E91E63</item> </style>

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

2 participants