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

InflateException #81

Open
sdroider opened this issue Jan 29, 2018 · 1 comment
Open

InflateException #81

sdroider opened this issue Jan 29, 2018 · 1 comment

Comments

@sdroider
Copy link

sdroider commented Jan 29, 2018

android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class io.github.yavski.fabspeeddial.FabSpeedDial at android.view.LayoutInflater.inflate(LayoutInflater.java:543) at android.view.LayoutInflater.inflate(LayoutInflater.java:427) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at com.appdroid.develop.socialro_bot.fragments.AccountsFragment.onCreateView(AccountsFragment.java:25) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2354) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1419) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809) at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799) at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580) at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367) at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2229) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700) at android.os.Handler.handleCallback(Handler.java:742) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:5523) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629) Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class io.github.yavski.fabspeeddial.FabSpeedDial at android.view.LayoutInflater.createView(LayoutInflater.java:649) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:768) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708) at android.view.LayoutInflater.rInflate(LayoutInflater.java:839) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) at android.view.LayoutInflater.inflate(LayoutInflater.java:519) at android.view.LayoutInflater.inflate(LayoutInflater.java:427)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  at com.appdroid.develop.socialro_bot.fragments.AccountsFragment.onCreateView(AccountsFragment.java:25)  at android.support.v4.app.Fragment.performCreateView(Fragment.java:2354)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1419)  at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)  at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799)  at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580)  at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367)  at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322)  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2229)  at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700)  at android.os.Handler.handleCallback(Handler.java:742)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:5523)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance(Native Method) at android.view.LayoutInflater.createView(LayoutInflater.java:623) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:768)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:839)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)  at android.view.LayoutInflater.inflate(LayoutInflater.java:519)  at android.view.LayoutInflater.inflate(LayoutInflater.java:427)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  at com.appdroid.develop.socialro_bot.fragments.AccountsFragment.onCreateView(AccountsFragment.java:25)  at android.support.v4.app.Fragment.performCreateView(Fragment.java:2354)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1419)  at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)  at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799)  at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580)  at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367)  at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322)  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2229)  at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700)  at android.os.Handler.handleCallback(Handler.java:742)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:5523)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)  Caused by: android.util.AndroidRuntimeException: You must specify the gravity of the Fab. at io.github.yavski.fabspeeddial.FabSpeedDial.resolveCompulsoryAttributes(FabSpeedDial.java:186) at io.github.yavski.fabspeeddial.FabSpeedDial.init(FabSpeedDial.java:151) at io.github.yavski.fabspeeddial.FabSpeedDial.<init>(FabSpeedDial.java:140) at java.lang.reflect.Constructor.newInstance(Native Method)  at android.view.LayoutInflater.createView(LayoutInflater.java:623)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:768)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:839)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)  at android.view.LayoutInflater.inflate(LayoutInflater.java:519)  at android.view.LayoutInflater.inflate(LayoutInflater.java:427)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  

@flaringapp
Copy link

flaringapp commented May 10, 2019

Hi! Having researched a bit library code, I noticed some required attributes:

 if (typedArray.hasValue(R.styleable.FabSpeedDial_fabMenu)) {
            menuId = typedArray.getResourceId(R.styleable.FabSpeedDial_fabMenu, 0);
        } else {
            throw new AndroidRuntimeException("You must provide the id of the menu resource.");
        }

        if (typedArray.hasValue(R.styleable.FabSpeedDial_fabGravity)) {
            fabGravity = typedArray.getInt(R.styleable.FabSpeedDial_fabGravity, DEFAULT_MENU_POSITION);
        } else {
            throw new AndroidRuntimeException("You must specify the gravity of the Fab.");
        } 
}

So you should set fabMenu and fabGravity
Also if you try to set view ID as R.id.fab, library will throw a ClassCastException as it has it's own view somewhere inside with same id

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