본문 바로가기

Android

Android Compose TextField 관련 에러 java.lang.NoSuchMethodError: No virtual method setStylusHandwritingEnabled...

TextField 클릭 시 아래와 같은 Crash 가 발생하였다.

java.lang.NoSuchMethodError: No virtual method setStylusHandwritingEnabled(Z)V in class Landroid/view/inputmethod/EditorInfo; or its super classes (declaration of 'android.view.inputmethod.EditorInfo' appears in /system/framework/framework.jar!classes4.dex)

 

java.lang.NoSuchMethodError: No virtual method setStylusHandwritingEnabled(Z)V in class Landroid/view/inputmethod/EditorInfo; or its super classes (declaration of 'android.view.inputmethod.EditorInfo' appears in /system/framework/framework.jar!classes4.dex)
                                                                                                    	at androidx.core.view.inputmethod.EditorInfoCompat$Api35Impl.setStylusHandwritingEnabled(EditorInfoCompat.java:606)
                                                                                                    	at androidx.core.view.inputmethod.EditorInfoCompat.setStylusHandwritingEnabled(EditorInfoCompat.java:215)
                                                                                                    	at androidx.compose.foundation.text.input.internal.EditorInfo_androidKt.update-pLxbY9I(EditorInfo.android.kt:168)
                                                                                                    	at androidx.compose.foundation.text.input.internal.EditorInfo_androidKt.update-pLxbY9I$default(EditorInfo.android.kt:43)
                                                                                                    	at androidx.compose.foundation.text.input.internal.LegacyTextInputMethodRequest.createInputConnection(LegacyPlatformTextInputServiceAdapter.android.kt:264)
                                                                                                    	at androidx.compose.foundation.text.input.internal.LegacyTextInputMethodRequest.createInputConnection(LegacyPlatformTextInputServiceAdapter.android.kt:201)
                                                                                                    	at androidx.compose.ui.platform.InputMethodSession.createInputConnection(AndroidPlatformTextInputSession.android.kt:143)
                                                                                                    	at androidx.compose.ui.platform.AndroidPlatformTextInputSession.createInputConnection(AndroidPlatformTextInputSession.android.kt:107)

로그 확인해보니 나오는 setStylusHandwritingEnabled 의 경우 API level 35 에 추가 되었다고 한다.

gradle 버전을 일괄적으로 업데이트 한 이후에 발생했기 때문에 버전 문제일 것으로 예상하여 core-ktx 버전 업데이트로 해결되었다!

https://developer.android.com/reference/kotlin/android/view/inputmethod/EditorInfo#setstylushandwritingenabled

 

EditorInfo  |  Android Developers

 

developer.android.com

https://mvnrepository.com/artifact/androidx.core/core-ktx