[Android] ButterKnife | The given artifact contains a string literal with a package reference 'android.support.v4.content' that cannot be safely rewritten. for androidx

Happy Jiwon·2023년 3월 23일
1

Error

목록 보기
1/2
post-thumbnail

에러

The given artifact contains a string literal with a package reference 'android.support.v4.content' that cannot be safely rewritten. for androidx

ButterKnife를 이용한 예제를 구현하던 중 빌드하다가 이런 에러가 로그캣에 나왔다.

이유

ButterKnife는 annotation을 사용하여 뷰들을 바인딩 하기 때문에 반드시 build.gradle에 annotationProcessor도 추가해주어야 한다.

해결(?)

implementation 'com.jakewharton:butterknife:10.2.3'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'

위와 같이 ButterKnife 라이브러리와 함께 annotationProcessor도 추가해주면 된다.

ButterKnife Github 참고
역시 에러 나면 공식 문서나 깃허브 참고하는게 제일 빠른 방법..

profile
공부가 조은 안드로이드 개발자

0개의 댓글