Skip to content

Cannot invoke "com.android.layoutlib.bridge.android.BridgeContext.isAppCompatTheme()" because "this.mContext" is null #630

@elihart

Description

@elihart

Description
We are seeing on CI that paparazzi occasionally fails with the error:

NullPointerException: Cannot invoke "com.android.layoutlib.bridge.android.BridgeContext.isAppCompatTheme()" because "this.mContext" is null

Steps to Reproduce
We are using Paparazzi with compose. The test class is in android unit test sources with junit 4.

class OurTestClass {
    @get:Rule
    val paparazzi = Paparazzi(
        deviceConfig = PIXEL_5.copy(
            softButtons = false,
            locale = "en-rUS"
        ),
        theme = "BaseUiPrimitivesTheme.TabNav",
        renderingMode = SessionParams.RenderingMode.NORMAL,
    )

 @Test
 fun ourTestFunction() {
   paparazzi.snapshot {
     // Compose UI
   }
 }
}

Sorry, I don't have any better repro steps and can't tell why it only sometimes happens.

Expected behavior
Test should run consistently without crashing

Additional information:

  • Paparazzi Version: 1.1.0
  • OS: Linux
  • Compile SDK: 33
  • Gradle Version: 7.5.1
  • Android Gradle Plugin Version: 7.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions