Today I Learn

TIL - ViewBinding error : too many parameters

SeungYong.Lee 2023. 1. 5. 17:11
반응형

ViewBinding을 프로젝트에 적용 후, 빌드 과정에서 제목과 같은 Error가 발생했다.

 

- ViewBinding 적용 방법 

//In build.gradle(:app)
buildFeatures {
    viewBinding = true
}

 

문제가 발생한 위치를 찾아보니 매우 많은 수의 View들이 사용되는 위젯 레이아웃에서 발생한 문제였다.

현재 위젯은 By Id 기준으로 사용 중이니, 다음과 같이 최상위 View에 ViewBinding 적용을 무시하도록 하면 해결된다.

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:tools="http://schemas.android.com/tools"
    tools:viewBindingIgnore="true">

 

참고

https://stackoverflow.com/questions/64633323/gradle-too-many-parameters-for-viewbinding
반응형