Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lateinit property initialState has not been initialized in version 2.1.4 #148

Open
Ahmed-Adel-Ismail opened this issue Aug 23, 2019 · 11 comments
Labels

Comments

@Ahmed-Adel-Ismail
Copy link

the same issue here :
#119

is happening on version 2.1.4, not fixed yet ... these are the logs :

Caused by: kotlin.UninitializedPropertyAccessException: lateinit property initialState has not been initialized
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton.access$getInitialState$p(CircularProgressButton.kt:21)
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton$morphAnimator$2.invoke(CircularProgressButton.kt:70)
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton$morphAnimator$2.invoke(CircularProgressButton.kt:21)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton.getMorphAnimator(Unknown Source:7)
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton.dispose(CircularProgressButton.kt:171)
at java.lang.reflect.Method.invoke(Native Method)
at androidx.lifecycle.ClassesInfoCache$MethodReference.invokeCallback(ClassesInfoCache.java:216)
at androidx.lifecycle.ClassesInfoCache$CallbackInfo.invokeMethodsForEvent(ClassesInfoCache.java:194)
at androidx.lifecycle.ClassesInfoCache$CallbackInfo.invokeCallbacks(ClassesInfoCache.java:185)
at androidx.lifecycle.ReflectiveGenericLifecycleObserver.onStateChanged(ReflectiveGenericLifecycleObserver.java:36)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:361)
at androidx.lifecycle.LifecycleRegistry.backwardPass(LifecycleRegistry.java:316)
at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:334)
at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:145)
at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:131)
at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:123)
at androidx.lifecycle.ReportFragment.onDestroy(ReportFragment.java:108)
at android.app.Fragment.performDestroy(Fragment.java:2870)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1424)
at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1554)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1616)
at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3044)
at android.app.FragmentManagerImpl.dispatchDestroy(FragmentManager.java:3024)
at android.app.FragmentController.dispatchDestroy(FragmentController.java:244)
at android.app.Activity.performDestroy(Activity.java:7251)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1249)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4492)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4523)
at android.app.ActivityThread.-wrap5(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1683)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6701)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:249)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)

@mhelmi
Copy link

mhelmi commented Aug 25, 2019

The issue here, still happening on 2.1.5

@mhelmi
Copy link

mhelmi commented Aug 25, 2019

The problem happened for me when I observe loadingLiveData to start or stop animation if I transaction another fragment and back to the fragment that included the CircleProgressButton it's start to observe loadingLiveData variable again and get the last value and try to revert morph animation while the current state is stop so it's crashes and give the above error.

I solved this problem by check the state before morph, so the btn can't start morph while it's not morph any more.
The working check solution for my case was:

if (btn.getState().equals(State.MORPHING) || btn.getState().equals(State.PROGRESS)) btn.startMorphRevertAnimation();

@leandroBorgesFerreira
Copy link
Owner

Sorry, taking so long for the reply. I'll take a look as soon as I can.

@uncledoc
Copy link

I have the same issue on android 4.2.2

@chetan3333
Copy link

The same issue is happening to me as well

@mhelmi
Copy link

mhelmi commented Sep 14, 2020

it there any update for this issue? @leandroBorgesFerreira
I have faced it when I am using btn in the adapter and try to update adapter to start loading

@leandroBorgesFerreira
Copy link
Owner

leandroBorgesFerreira commented Mar 23, 2021

Sorry for the late response... I can't reproduce it in the sample app. I fire the start animation inside the onCreate of an activity and it works just fine =|

Maybe inside a fragment... Let's see.

@piotrwroblewski90
Copy link

piotrwroblewski90 commented Mar 25, 2021

I' have the same issue in version 2.2.0

@josechagas
Copy link

josechagas commented Sep 15, 2021

I' have the same issue in version 2.2.0.
Please take a look at this stacktrace

Caused by kotlin.UninitializedPropertyAccessException: lateinit property initialState has not been initialized
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton.access$getInitialState$p(CircularProgressButton.kt:21)
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton$morphAnimator$2.invoke(CircularProgressButton.kt:70)
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton$morphAnimator$2.invoke(CircularProgressButton.kt:21)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton.getMorphAnimator(:7)
at br.com.simplepass.loadingbutton.customViews.CircularProgressButton.dispose(CircularProgressButton.kt:171)
at java.lang.reflect.Method.invoke(Method.java)
at androidx.lifecycle.ClassesInfoCache$MethodReference.invokeCallback(ClassesInfoCache.java:216)
at androidx.lifecycle.ClassesInfoCache$CallbackInfo.invokeMethodsForEvent(ClassesInfoCache.java:194)
at androidx.lifecycle.ClassesInfoCache$CallbackInfo.invokeCallbacks(ClassesInfoCache.java:185)
....

@pacifire
Copy link

pacifire commented Nov 20, 2021

Same issue...

Got Stacktrace from Crashlytics console.

Caused by kotlin.UninitializedPropertyAccessException: lateinit property initialState has not been initialized
       at br.com.simplepass.loadingbutton.customViews.CircularProgressButton.access$getInitialState$p(CircularProgressButton.kt:21)
       at br.com.simplepass.loadingbutton.customViews.CircularProgressButton$morphAnimator$2.invoke(CircularProgressButton.kt:70)
       at br.com.simplepass.loadingbutton.customViews.CircularProgressButton$morphAnimator$2.invoke(CircularProgressButton.kt:21)
       at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
       at br.com.simplepass.loadingbutton.customViews.CircularProgressButton.getMorphAnimator(:7)
       at br.com.simplepass.loadingbutton.customViews.CircularProgressButton.dispose(CircularProgressButton.kt:171)
       at java.lang.reflect.Method.invoke(Method.java)
       at androidx.lifecycle.ClassesInfoCache$MethodReference.invokeCallback(ClassesInfoCache.java:216)
       at androidx.lifecycle.ClassesInfoCache$CallbackInfo.invokeMethodsForEvent(ClassesInfoCache.java:194)
       at androidx.lifecycle.ClassesInfoCache$CallbackInfo.invokeCallbacks(ClassesInfoCache.java:185)
       at androidx.lifecycle.ReflectiveGenericLifecycleObserver.onStateChanged(ReflectiveGenericLifecycleObserver.java:37)
       at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:361)
       at androidx.lifecycle.LifecycleRegistry.backwardPass(LifecycleRegistry.java:316)
       at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:334)
       at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:145)
       at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:131)
       at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:68)
       at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:144)
       at androidx.lifecycle.ReportFragment.onDestroy(ReportFragment.java:134)
       at android.app.Fragment.performDestroy(Fragment.java:2782)
       at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1451)
       at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1581)
       at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1642)
       at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3051)
       at android.app.FragmentManagerImpl.dispatchDestroy(FragmentManager.java:3031)
       at android.app.FragmentController.dispatchDestroy(FragmentController.java:248)
       at android.app.Activity.performDestroy(Activity.java:7521)
       at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1307)
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4502)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4535)
       at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:39)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:201)
       at android.app.ActivityThread.main(ActivityThread.java:6826)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

@ChhaiHout
Copy link

It seem like I could prevent that crash by calling button to dispose in onDestroyView :
override fun onDestroyView() { super.onDestroyView() progressButton.dispose() }
FYI : use in Fragment

This crash happened when I call dispose in onDestroy :
override fun onDestroy() { super.onDestroy() progressButton.dispose() }

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

No branches or pull requests

9 participants