kotlin data class redeclaration error 해결하기

2022. 12. 10. 15:11·Android

현재 진행하는 사이드 프로젝트 작업 중 데이터 클래스에 대해서 파일을 하나만 선언했는데에도 gradle 빌드 중 redeclaration 오류가 발생하는 현상이 있었다.

 

Windows 환경에서는 잘 동작하지만 Mac 환경에서는 항상 발생하는 것으로 봐서 환경적인 문제로 생각되어 Invalidate cache 및 Restart 시도 해봤지만 동일하게 발생하여 구글링 한 결과 해결할 수 있었다.

 

gradle 캐시를 지운 후 정상적으로 동작했다.

./gradlew clean
rm -rf ~/.gradle/caches/*

Mac 또는 Linux 환경에서 권한이 없다고 아래처럼 터미널 창에 표시 될 경우에는 chmod 명령어를 통해 권한을 주자.

zsh: permission denied: ./gradlew

여튼 위의 명령어를 통해 오류를 해결할 수 있었다!!

 

Reference : 

https://stackoverflow.com/questions/56795138/kotlin-file-changes-result-in-redeclaration-error

 

Kotlin file changes result in Redeclaration error

Every change to a kotlin file results in a Redeclaration error when building. The only way around it is by cleaning the project and then rebuilding. There are no other files in the project with the...

stackoverflow.com

 

'Android' 카테고리의 다른 글

A problem occurred configuring root project 'Unscramble'.> Could not resolve all files for configuration ':classpath'. 오류해결  (0) 2023.06.08
Android AppBar(Toolbar) Menu에 Lottie 사용하기  (0) 2022.12.19
manifestPlaceholders가 값을 찾지 못할 때 해결방법  (0) 2022.11.27
Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView  (0) 2022.11.13
android studio에서 실행한 앱이 설치되지 않을 때  (0) 2022.11.06
'Android' 카테고리의 다른 글
  • A problem occurred configuring root project 'Unscramble'.> Could not resolve all files for configuration ':classpath'. 오류해결
  • Android AppBar(Toolbar) Menu에 Lottie 사용하기
  • manifestPlaceholders가 값을 찾지 못할 때 해결방법
  • Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView
HWBB
HWBB
흥미주도개발자
  • HWBB
    코딩공부방
    HWBB
  • 전체
    오늘
    어제
    • 분류 전체보기 (164)
      • 알고리즘 (61)
      • Android (27)
      • Kotlin (0)
      • Java (2)
      • Design Pattern (2)
      • React Native (1)
      • Python (0)
      • TIL (21)
      • Unity (0)
      • React (2)
      • AWS (0)
      • Git (11)
      • MFC (1)
      • Spring (4)
      • Computer Science (4)
      • Vue (4)
      • Infra (6)
      • 박현우 (10)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • 승윤이
  • 공지사항

  • 인기 글

  • 태그

    깃허브
    GIT
    programmers
    안드로이드
    코틀린
    Android
    코딩테스트
    안드로이드 스튜디오
    coding
    github
    자바
    백준
    알고리즘
    algorithm
    Java
    baekjoon
    프로그래머스
    AWS
    android studio
    Kotlin
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
HWBB
kotlin data class redeclaration error 해결하기
상단으로

티스토리툴바