facebook / flipper

A desktop debugging platform for mobile developers.
https://fbflipper.com/
MIT License
13.37k stars 952 forks source link

Question: Flipper layout inspector can't see any component #5682

Closed duowanSir closed 16 hours ago

duowanSir commented 2 weeks ago

I wrote a very simple demo based on the onboarding/HelloWorldActivity code in litho(v2024.10.07)/sample, but I can't see any components when using flipper inspect.

This is my demo flipper screenshot

image

This is official demo flipper screenshot

image

I don't know why this happens, I need help,thank you!!!

duowanSir commented 2 weeks ago

Code in my application:

` class MagpieCardDemoApplication : Application() {

override fun onCreate() {
    super.onCreate()

    subscribe(DebugEventLogger())

    Fresco.initialize(this)
    FrescoVito.initialize()
    SoLoader.init(this, false)

    if (FlipperUtils.shouldEnableFlipper(this)) {
        val client = AndroidFlipperClient.getInstance(this)
        val uiDebuggerContext = create(this)
        enable(uiDebuggerContext)
        client.addPlugin(UIDebuggerFlipperPlugin(uiDebuggerContext))
        val descriptorMapping = DescriptorMapping.withDefaults()
        LithoFlipperDescriptors.add(descriptorMapping)
        client.addPlugin(InspectorFlipperPlugin(this, descriptorMapping))
        client.addPlugin(SectionsFlipperPlugin(true))
        client.start()
    }
}

}`

Code in my activity: ` class MagpieCardDemoActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) val utf8RichText = "" val c = ComponentContext(this) setContentView(LithoView.create(this, Text.create(c).text("Hello World!").build()))

}

}`

It's almost the same like sample, so do I lost some other key condition?

duowanSir commented 16 hours ago

I found it, I miss ComponentsConfiguration.isDebugModeEnabled = true