Skip to content

Android late init carContext crash #164

Open
@KestasVenslauskas

Description

Describe the bug
Just installed this package with all setup mentioned in documentation for android.
App crashes when creating the template for example new ListTemplate({...})
Because it already expect carContext to be initialised.

                 kotlin.UninitializedPropertyAccessException: lateinit property carContext has not been initialized
                 	at org.birkir.carplay.CarPlayModule.createScreen(CarPlayModule.kt:276)
                 	at org.birkir.carplay.CarPlayModule.createTemplate$lambda$0(CarPlayModule.kt:109)
                 	at org.birkir.carplay.CarPlayModule.$r8$lambda$KGCg1YkdHhdDVzVWZBIlxyzACWg(Unknown Source:0)
                 	at org.birkir.carplay.CarPlayModule$$ExternalSyntheticLambda0.run(Unknown Source:8)
                 	at android.os.Handler.handleCallback(Handler.java:958)
                 	at android.os.Handler.dispatchMessage(Handler.java:99)
                 	at android.os.Looper.loopOnce(Looper.java:205)
                 	at android.os.Looper.loop(Looper.java:294)
                 	at android.app.ActivityThread.main(ActivityThread.java:8194)
                 	at java.lang.reflect.Method.invoke(Native Method)

Expected behavior
A clear and concise description of what you expected to happen.

Android Auto (please complete the following information):

  • Device: Various android emulators & Pixel 6a
  • OS version from 9 to 14
  • RNCarPlay version 2.4.0-beta.2

Additional context
Interesting that when I call CarPlay.registerOnConnect(onConnectHandler); I do get callback called instantly.
I just ran the app in a emulator that should not have any android auto or automotive connection yet.

UPDATE: Just tried connecting to android auto HUD before launching the app - same result

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions