Materialdrawer: java.lang.IllegalStateException: Child drawer has absolute gravity RIGHT but this DrawerLayout already has a drawer view along that edge

Created on 27 Apr 2017  路  11Comments  路  Source: mikepenz/MaterialDrawer

I'm having this issue. It happens once in a while. Hope you can help me!
Here is the stack:

Fatal Exception: java.lang.IllegalStateException: Child drawer has absolute gravity RIGHT but this DrawerLayout already has a drawer view along that edge
       at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1096)
       at android.view.View.measure(View.java:17923)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
       at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
       at android.view.View.measure(View.java:17923)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
       at android.view.View.measure(View.java:17923)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
       at android.view.View.measure(View.java:17923)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1723)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:785)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:654)
       at android.view.View.measure(View.java:17923)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5698)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:465)
       at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2743)
       at android.view.View.measure(View.java:17923)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2412)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1414)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1638)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1292)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6598)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800)
       at android.view.Choreographer.doCallbacks(Choreographer.java:603)
       at android.view.Choreographer.doFrame(Choreographer.java:572)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)
       at android.os.Handler.handleCallback(Handler.java:815)
       at android.os.Handler.dispatchMessage(Handler.java:104)
       at android.os.Looper.loop(Looper.java:194)
       at android.app.ActivityThread.main(ActivityThread.java:5674)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)

PD. Thansk 4 ur wonderfull library!

question

Most helpful comment

this error happens when you add two navigationview with same gravity to 1 drawerlayout

All 11 comments

@maxhectorizquierdo could you please also add some information what you try to do? the errortext is thrown from the DraverLayout so it could be everything.

Well, actually I can't figure out how to emulate the error, because I noticed it from my Fabric dashboard. I just have the complete Stack Error.

Plus this information:

OS Version: 5.1

Device: HUAWEI LUA-L03

RAM Free: 31.4%

Disk Free: 43.4%

do you also see if it was in RTL mode or not?

No it wasn't. :(

It seems it happens after a time the user pauses the app(when the app comes to the background) and then he resumes it , maybe two hours after(and comes to the foreground) in that very moment the app crashes along with the DrawerLayout. I just 've experienced this a few seconds ago.

@maxhectorizquierdo can you provide a small demo application which reproduces this. I can't see it in the sample app

Closing until more details are provided as it was not reproduceable

this error happens when you add two navigationview with same gravity to 1 drawerlayout

I had the same problem. And it happens when you don't have proper handling of fragments. The way I solved my problem was that I was creating the fragment again, so there were two fragments added after the app was killed in the background. One was the automatic recreated fragment and the second was mine, so then 2 drawer menus are added on the same side of the layout, which causes the exception.
So then I decided to check if the fragment was recreated, and if it is then use that one, if not then created and add it.

I found this issue when it comes to RTL languages. If you open the drawer, then tap on the outside of an open drawer, i get this crash. I am working on a solution at the moment

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sonh picture sonh  路  3Comments

Meeks91 picture Meeks91  路  3Comments

ghost picture ghost  路  3Comments

fuentepa picture fuentepa  路  3Comments

y2kshane picture y2kshane  路  4Comments