룬아님의 취중코딩

Multi Module에서 Hilt를 사용할 때에 cannot access가 발생하는 이슈 본문

개발/안드로이드 개발

Multi Module에서 Hilt를 사용할 때에 cannot access가 발생하는 이슈

룬아님 2021. 5. 20. 00:50

Data, Domain 모듈을 분리하고 Hilt를 적용하던 도중

error: cannot access ProductsRemoteDataSource
  class file for com.runeanim.data.source.remote.ProductsRemoteDataSource not found
  Consult the following stack trace for details.
  com.sun.tools.javac.code.Symbol$CompletionFailure: class file for com.runeanim.data.source.remote.ProductsRemoteDataSource not found
cannot access ProductsRemoteDataSource

위와 같은 컴파일 에러가 계속 발생되었다.

https://github.com/google/dagger/issues/1991#issuecomment-707260546

 

Suggestion needed for using Hilt in library modules · Issue #1991 · google/dagger

In my sample app I have created a separate library module called core. In the core module I am using network and db related dependencies like OkHttp, Retrofit and Room. Hence to access these instan...

github.com

나와 같은 증상을 겪는 사람을 Dagger Issue에서 찾을 수 있었고
implementation대신 api를 사용하는 방법으로 해결하였다.

    implementation project(':data')
    implementation project(':domain')
    
    ->
    
    api project(':data')
    implementation project(':domain')


implementation과 api의 차이가 잘 설명되어 있는 곳을 첨부한다.

 

Implementation VS Api in Android Gradle Plugin - 번역

최초 작성일 : 2017-08-28 17:23:49최종 수정 : 2017-11-29 글에 앞서안녕하세요?룩핀에서 안드로이드 개발을 하고 있는 오경식 이라고 합니다.이 글은 인도 벵갈루루의 Bedanta Bikash Borah님이 Medium에 올린 I

sikeeoh.github.io

 

반응형
Comments