반응형

안드로이드 스튜디오에서 Empty Activity 프로젝트를 만들자마자 아래와 같은 문제가 발생했다.

 

 

 

 

빨간 줄에 마우스를 가져가면 아래와 같은 문구를 얻을 수 있다.

 

Cannot access 'androidx.lifecycle.LifecycleOwner' which is a supertype of 'com.hydroponicglass.rainyday.MainActivity'. Check your module classpath for missing or conflicting dependencies

 

구글링 해보니 Flutter에서 위와 같은 이슈가 있나 보다. 그러나 현재 프로젝트는 Flutter로 만들어지지도 않았고 Flutter 플러그인이 설치되어있지도 않다.

 

Flutter 이슈 참조

 

Cannot access 'android.arch.lifecycle.LifecycleOwner' which is a supertype of 'com.ex.app.MainActivity'. Check your module class

Dismiss Join GitHub today GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together. Sign up

github.com

 

여러 삽질 후 찾은 원인은 프로젝트 생성시 체크 항목인 "Use legacy android.support libraries" 미체크에 있었다. 이를 체크하고 프로젝트를 생성하면 해결할 수 있다.

 

 

 

 

안드로이드가 9버전으로 올라오면서 이전 라이브러리는 android.support.*에 포함되며 신규 라이브러리는 androidx에 포함된다. 그리고 "Use legacy android.support libraries"는 이전 라이브러리를 사용하겠다는 뜻이다. 프로젝트 생성 시 만들어져 있는 기본 코드는 이전 라이브러리인데 이전 라이브러리를 사용하지 않겠다고 해서 오류가 발생한 것 같다.