Android 50

Caused by: java.lang.IllegalArgumentException: MaterialThemeUsingMdcTheme requires the host context's theme to extend Theme.MaterialComponents

Caused by: java.lang.IllegalArgumentException: MaterialThemeUsingMdcTheme requires the host context's theme to extend Theme.MaterialComponents at com.google.android.material.composethemeadapter.MdcTheme.createMdcTheme(MdcTheme.kt:134) at com.google.android.material.composethemeadapter.MdcTheme.createMdcTheme$default(MdcTheme.kt:125) at com.google.android.material.composethemeadapter.MdcTheme.Mdc..

Android Studio build error - compileDebugJavaWithJavac task (current target it 1.8) and kaptGenerateStubsDebugKotlin task (current target is 17)

Before compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" freeCompilerArgs = listOf("-Xjvm-default=enable") } After >>> JavaVersion.VERSION_1_8.toString() compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = JavaVersio..

Inheritance from an interface with '@JvmDefault' members is only allowed with -Xjvm-default option

Inheritance from an interface with '@JvmDefault' members is only allowed with -Xjvm-default option viewModel 에 param을 추가하였더니 viewModel Factory가 필요하고, 추가 하니 위와 같은 에러가 나왔다~ 버전 충돌 문제인데~ build.gradle.app 에 kotlinOptions { jvmTarget = '1.8' freeCompilerArgs += [ '-Xjvm-default=enable' ] } 또는 tasks.withType(KotlinCompile).configureEach { kotlinOptions { freeCompilerArgs += [ "-Xjvm-default=all", ] } }..

Resource IDs will be non-final by default in Android Gradle Plugin version 8.0, avoid using them in switch case statements

switch 문에서 case R.id.xxxx 를 더 이상 제공 하지 않는다고 한다. 간단하게 if else 문으로 대체 하면 되는데 case 문이 많을 경우 난감하고 귀찮다. 이럴 때는 간단히 Refactoring 을 하면 된다. switch 에 커서를 올리고 Option(Windows Alt) + enter 를 치고 Replace switch with if 를 선택하면 한 방에 해결 된다.

LiveData 와 MutableLiveData

MutableLiveData는 Abstract Class 인 LiveData를 구현한 Public Class 위 말을 풀어 보면, 1. LiveData는 추상 클래스이므로 직접 생성할 수 없다. public abstract class LiveData { protected void postValue(T value) {} @MainThread protected void setValue(T value) {} //데이터 수정은 pretected 메서드를 구현해서 사용해야 한다. } val name : LiveData = LiveData() 위와 같이 직접 생성할 경우 아래와 같이 에러가 발생한다. cannot create an instance of an abstract class 반면에 MutableLiveDa..

android worker ClassNotFoundException

Room 에서 DB 가 만들어지고, 초기화를 할 때 OnCreate() 에서 아래와 같이 워커를 불러서 작업을 하는데, val request = OnTimeWorkRequestBuilder().build() WorkManager.getInstance(context).enqueue(request) enqueue 에 작업을 넣으려고 하면 아래와 같이 요상한 에러가 난다. 아무리 인터넷을 뒤져도 답이 없다. E/AndroidRuntime: FATAL EXCEPTION: arch_disk_io_0 java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/work/impl/utils/futures/AbstractFuture; Caused by: java.l..