본문 바로가기
반응형

2023년 이전/Android39

IllegalArgumentException :cannot add the same observer with different lifecycles & viewLifecycleOwner 참고 https://uchun.dev/caution-when-using-a-fragment-viewLifecycleOwner/ Fragment 에서 ViewLifecycleOwner 사용 시 주의점 시작하기에 앞서 uchun.dev Android 개발을 하다가 다음과 같은 exception Log를 보게 되었습니다. java.lang.IllegalArgumentException: Cannot add the same observer with different lifecycles 발생한 이유는 LiveData의 Observer가 다른 owner에 포함이 되어 있다면 , LiveData는 위의 exception을 반환합니다. 즉, 하나의 activity에 있는 viewModel의 LiveData를 가져다 사용.. 2021. 12. 5.
Corutine callbackFlow sendBlocking Deprecated 코루틴의 callbackFlow 에서 sendBlocking 이 Deprecated가 되었다. 그럼 어떻게 써야하는가? trySendBlocking 로 변경해서 사용하면 된다. 그럼 무슨 차이가 있을까? 코드에 적혀있는 설명을 보면 trySendBlocking은 Adds element into to this channel, blocking the caller while this channel is full, and returning either successful result when the element was added, or failed result representing closed channel with a corresponding exception. This is a way to call Ch.. 2021. 12. 5.
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction Android 에서 사용하는 라이브러리들의 버전을 높이다가 위와 같은 error를 보게 되었습니다. 제가 해결한 방법은 버전을 다 최신으로 바꾼다. annotationProcessor → kapt 로 바꾼다. layout에 있는 android:addTextChangeListener 가 사라졌으니 BindingAdapter에 추가해준다. @BindingAdapter("addTextChangedListener") fun addTextChangeListener(editText: EditText, textWatcher: TextWatcher){ editText.addTextChangedListener(textWatcher) } Impl class에 있는 @Single을 지우고 Module 에있는 Activity.. 2021. 12. 5.
Module was compiled with an incompatible version of Kotlin 안드로이드 빌드시에 발생하는 에러인데, 너무 최신의 Kotlin을 설치하면 발생하는 에러입니다. Android Project / build.gradle 파일에 있는 build script를 수정하면 됩니다 2021. 12. 5.
반응형