Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Seems to be a DNS problem with systems that have 'obtain DNS server address automatically'. Changed my system to a manual setting and the browser etc now work. SDK 2.2 didn't seem to mind the auto setting though.
ap...@google.com <ap...@google.com> #3
Could you please describe how/where you changed your system to a manual setting?
il...@google.com <il...@google.com> #4
Based on its date, this issue was originally reported before Android 2.3. Because of the many changes that existed in Android 4.x compared to previous versions, it's very likely that this issue doesn't exist in recent versions of Android like 4.2.2 or newer. Because of the high likelihood that this issue is obsolete, it is getting closed automatically by a script, without a human looking at it in detail. If the issue still exists on a Nexus 4 or Nexus 7 running Android 4.2.2 and is not related to Google applications, please open a new report accordingly.
Description
Build: AI-201.8743.12.41.6953283, 202011050241,
AI-201.8743.12.41.6953283, JRE 1.8.0_242-release-1644-b3-6222593x64 JetBrains s.r.o, OS Linux(amd64) v5.4.0-53-generic, screens 3440x1440
AS: 4.1.1; Kotlin plugin: 1.4.10-release-Studio4.1-1; Android Gradle Plugin: 4.1.1; Gradle: 6.5; NDK: from local.properties: (not specified), latest from SDK: 21.3.6528147; LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: 3.16.3
Affected version:
androidx.fragment:fragment-ktx:1.2.5
Note: It looks like all versions starting from 1.2+ are affected
Description
When you have view pager with nested fragment that shows menu it will crash if you try to access menu items from
onPrepareOptionsMenu
.Steps to reproduce
ViewPager
Fragment1
Fragment2
Fragment2
add nestedFragment21
and enablesetHasOptionsMenu(true)
, also add new menu specific to this fragmentFragment21
fromonPrepareOptionsMenu
Expected behavior
onPrepareOptionsMenu
should never be called if menu is not inflatedActual behavior
onPrepareOptionsMenu
Additional information
Looking through the changes I was able to pinpoint it to this behavior change:https://android.googlesource.com/platform/frameworks/support/+/4809e01d4153a5ba68cb68f36544baa1b90738c0
We are now also checking for parent menu visibility but only in
dispatchCreateOptionsMenu
, which means we would calldispatchPrepareOptionsMenu
with no menu inflated since we skipped it.Possible fix
dispatch*Menu
methods, ordispatchCreateOptionsMenu
Demo repository:
You can find repository with repro steps here:https://github.com/vovkab/fragment-menu-crash