You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2020-03-26 13:01:23.808 8969-8969/com.mypackage E/com.facebook.flipper.plugins.inspector.descriptors.utils.stethocopies.ReflectionUtil: Could not retrieve mAdded field from class androidx.fragment.app.FragmentManagerImpl
java.lang.NoSuchFieldException: No field mAdded in class Landroidx/fragment/app/FragmentManagerImpl; (declaration of 'androidx.fragment.app.FragmentManagerImpl' appears in /data/app/com.mypackage-5E855k89Sn36xw35D2A==/base.apk)
at java.lang.Class.getDeclaredField(Native Method)
at com.facebook.flipper.plugins.inspector.descriptors.utils.stethocopies.ReflectionUtil.tryGetDeclaredField(ReflectionUtil.java:29)
at com.facebook.flipper.plugins.inspector.descriptors.utils.stethocopies.FragmentCompat$FragmentManagerAccessorViaReflection.getAddedFragments(FragmentCompat.java:88)
at com.facebook.flipper.plugins.inspector.descriptors.utils.stethocopies.FragmentCompatUtil.findFragmentForViewInFragmentManager(FragmentCompatUtil.java:82)
at com.facebook.flipper.plugins.inspector.descriptors.utils.stethocopies.FragmentCompatUtil.findFragmentForViewInActivity(FragmentCompatUtil.java:73)
at com.facebook.flipper.plugins.inspector.descriptors.utils.stethocopies.FragmentCompatUtil.findFragmentForViewInActivity(FragmentCompatUtil.java:48)
at com.facebook.flipper.plugins.inspector.descriptors.utils.stethocopies.FragmentCompatUtil.findFragmentForView(FragmentCompatUtil.java:39)
at com.facebook.flipper.plugins.inspector.descriptors.ViewGroupDescriptor.getAttachedFragmentForView(ViewGroupDescriptor.java:321)
at com.facebook.flipper.plugins.inspector.descriptors.ViewGroupDescriptor.getChildAt(ViewGroupDescriptor.java:132)
at com.facebook.flipper.plugins.inspector.descriptors.ViewGroupDescriptor.getChildAt(ViewGroupDescriptor.java:32)
at com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin$14.runOrThrow(InspectorFlipperPlugin.java:593)
at com.facebook.flipper.core.ErrorReportingRunnable.run(ErrorReportingRunnable.java:24)
at com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin.getNode(InspectorFlipperPlugin.java:597)
at com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin.access$300(InspectorFlipperPlugin.java:31)
at com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin$5.onReceiveOnMainThread(InspectorFlipperPlugin.java:203)
at com.facebook.flipper.plugins.common.MainThreadFlipperReceiver$1.run(MainThreadFlipperReceiver.java:29)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6698)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
To Reproduce
Layout inspector with android x fragments
Environment
Flipper desktop mac, flipper for android 0.34
The text was updated successfully, but these errors were encountered:
A couple of clarifications on the initial bug report
The stacktrace posted does not cause a crash. Our app quickly runs out of memory when using the layout inspector in heavy screens but it's unrelated to this.
The easiest way to tweak the example app to repro is to change FragmentCompat line 40 to ReflectionUtil.tryGetClassForName("androidx.fragment.app.Fragment") != null
Thanks, @benoitdion! I got a repro now. It looks like the androidx migration we did was a bit haphazard. I'll try to get this fixed in the next few days.
Summary:
Fix#931
This is not how I would *like* to fix this, but it should do the job.
When the switch over to AndroidX was made, the overall abstraction
started to leak and we really need to remodel this in its entirety.
There's also the question of whether we want to support both support
fragments and AndroidX fragments or not. Right now it's kinda-sorta
supported but only under some circumstances, which is not great.
Test Plan:
Changed the sample app to include some AndroidX fragments and they
now show up (again) in the view hierarchy:
馃悰 Bug Report
It looks like we're looking for a
mAdded
fieldflipper/android/src/main/java/com/facebook/flipper/plugins/inspector/descriptors/utils/stethocopies/FragmentCompat.java
Line 87 in 48d6ea4
FragmentManagerImpl
but that field doesn't exist:https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/fragment/fragment/src/main/java/androidx/fragment/app/FragmentManagerImpl.java
mAdded
exists on the fragment themselves but not the manager.Would https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java#934 be useful for what we're trying to do here?
Stacktrace:
To Reproduce
Layout inspector with android x fragments
Environment
Flipper desktop mac, flipper for android 0.34
The text was updated successfully, but these errors were encountered: