Skip to content
This repository has been archived by the owner on Jun 22, 2022. It is now read-only.

Crash on checkLocaleChange #136

Open
julienherrero opened this issue May 2, 2022 · 1 comment
Open

Crash on checkLocaleChange #136

julienherrero opened this issue May 2, 2022 · 1 comment

Comments

@julienherrero
Copy link

Because of the lateinit var, currentLanguage can be used before its initialization :

2022-04-26 11:54:34.654 4223-4223/com.tabesto.myapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.tabesto.myapp, PID: 4223
    kotlin.UninitializedPropertyAccessException: lateinit property currentLanguage has not been initialized
        at com.akexorcist.localizationactivity.core.LocalizationActivityDelegate.checkLocaleChange(LocalizationActivityDelegate.kt:175)
        at com.akexorcist.localizationactivity.core.LocalizationActivityDelegate.access$checkLocaleChange(LocalizationActivityDelegate.kt:12)
        at com.akexorcist.localizationactivity.core.LocalizationActivityDelegate$onResume$1.run(LocalizationActivityDelegate.kt:37)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:246)
        at android.app.ActivityThread.main(ActivityThread.java:8653)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

You can facing this issue by using Direct-Boot : with this, we cannot initialize language before first onResume() call.

I've submited a PR to fix this : #135

@akexorcist
Copy link
Owner

Since AndroidX AppCompat has per-app language preferences for backward compatibility. Please migrate this library to AndroidX for more stability, compatibility, and longer support from Google team.

See Migrate to AndroidX guide

Thank you for your support

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants