Open Pirokar opened 2 years ago
Hi,
I have the exact same test device and I didn't see this issue yet. Googling the exception, maybe it has something to do with the type of Activity?
Can you find out which Activity is crashing, is it from your code or from somewhere else?
If you figure out for example its package name, you could disable Beagle for that Activity to fix the crash, like this:
Beagle.initialize(
application = this,
behavior = Behavior(
shouldAddDebugMenu = { fragmentActivity -> fragmentActivity.packageName != "the.package.name.for.the.activity" }
)
)
Let me know if a third party Activity is causing the problem so that I can add it to the library's internal list of excluded activities.
Hopefully this will solve the problem!
I've made "Beagle.initialize(...)" in Application class. Activity is just instance of AppCompatActivity Maybe this could help to create the fix: https://stackoverflow.com/questions/31746072/drawerlayout-must-be-measured-with-measurespec-exactly-error ?
I cannot reproduce this crash. I'm using the same device, same Android version and same Beagle version. I tried requesting the Camera permission from a Fragment, and I also tried it in the onCreate() of an Activity, but for me it's working as expected.
Are you maybe using a third party library to handle permissions? From the StackOverflow thread you linked, one possible reason could be an Activity that has a Fullscreen theme / a Dialog activity, maybe that library is inserting an invisible Activity to handle the callbacks from the permission prompt (in that case you could exclude it from Beagle as per my previous comment).
The Drawer from Beagle's side is definitely match_parent, otherwise we'd see this crash a lot more often.
Let me know if you have any other repro steps! Maybe, if you have the time, try to reproduce it on this repository, there is a demo app in the app
module (if you manage to do so, feel free to create a PR so that I can test and fix the problem, if it is indeed coming from the library).
Crash with permissions modal window appearing (android 12, sumsung galaxy note 10+, beagle: 2.8.2):
E/AndroidRuntime: FATAL EXCEPTION: main Process: io.edna.threads.demo, PID: 2113 java.lang.IllegalArgumentException: DrawerLayout must be measured with MeasureSpec.EXACTLY. at androidx.drawerlayout.widget.DrawerLayout.onMeasure(DrawerLayout.java:1090) at android.view.View.measure(View.java:27129) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7980) at android.widget.FrameLayout.onMeasure(FrameLayout.java:197) at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145) at android.view.View.measure(View.java:27129) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7980) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:27129) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7980) at android.widget.FrameLayout.onMeasure(FrameLayout.java:197) at android.view.View.measure(View.java:27129) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7980) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:27129) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7980) at android.widget.FrameLayout.onMeasure(FrameLayout.java:197) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:1277) at android.view.View.measure(View.java:27129) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:4528) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:3193) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3525) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2911) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10458) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1108) at android.view.Choreographer.doCallbacks(Choreographer.java:866) at android.view.Choreographer.doFrame(Choreographer.java:797) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8663) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)