Skip to content

Compose Preview crashes because of Parse init #1205

Open
@FlorinCusmereanu

Description

@FlorinCusmereanu

New Issue Checklist

Issue Description

Cannot run Preview

Steps to reproduce

Create a Preview page

Actual Outcome

Error

Expected Outcome

Component rendered in preview pane

Environment

Android

Parse Android SDK

  • SDK version: 4.2.1
  • Operating system version: Sonoma 14.2

Server

  • Parse Server version: FILL_THIS_OUT
  • Operating system: FILL_THIS_OUT
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): FILL_THIS_OUT

Database

  • System (MongoDB or Postgres): FILL_THIS_OUT
  • Database version: FILL_THIS_OUT
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): FILL_THIS_OUT

Logs

java.lang.NullPointerException: Cannot invoke "java.io.File.getAbsolutePath()" because the return value of "com.parse.ParseCacheDirMigrationUtils.getOldParseDir(android.content.Context)" is null

I am trying with this code to preview my signup component
I have tried initializing Parse in my preview, but it still doesn't work

@OptIn(ExperimentalMaterial3Api::class)
@Preview(showBackground = true)
@Composable
fun SignUpPagePreview() {

    val configuration = Parse.Configuration
        .Builder(LocalContext.current)
        .applicationId("****")
        .server("****")
        .build()
    Parse.initialize(configuration)
    Parse.enableLocalDatastore(LocalContext.current)

    CompositionLocalProvider(
        LocalUserState provides remember { UserStateViewModel() },
    ) {
        val navController = rememberNavController()
        SignUpPage(navController = navController)
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions