[안드로이드] 안드로이드 라이브러리 프로젝트 AAR 종속성 문제 (android library project aar dependency issue)
안드로이드 라이브러리 프로젝트를 AAR 로 만들면, AAR 안에는 종속 라이브러리들이 포함되지 않는다.
아래와 같이 라이브러리 프로젝트에서 retrofit 이 dependencies 걸려 있어도 aar 로 만들면 retrofit 은 제외하고 aar이 생성된다.
"transitive=true" 옵션도 이 문제를 해결해 주지 못함.
Ex)
apply plugin: 'com.android.library'
dependencies {
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
}
방법 1) Dependencies lib 를 jar 형태로 libs 폴더에 추가 후 AAR 생성
AAR 에 포함되어 배포된다.
방법 2) AAR 호출자가 직접 라이브러리 implementation
단순한 방법으로 AAR 호출자의 build.gradle 에 라이브러리들을 implementation
방법 3) Maven 저장소를 사용하고 gradle 이 pom 파일을 사용하여 종속성을 다운로드 할 수 있게 해야 한다
https://stackoverflow.com/questions/36916991/transitive-dependencies-for-local-aar-library
The aar file doesn't contain the nested (or transitive) dependencies and doesn't have a pom file which describes the dependencies used by the library.
It means that, if you are importing a aar file using a flatDir repo you have to specify the dependencies also in your project.
In your case adding transitive=true doesn't resolve your issue for the reason described above.
You should use a maven repository (you have to publish the library in a private or public maven repo), you will not have the same issue.
In this case, gradle downloads the dependencies using the pom file which will contains the dependencies list.
기타 : android-fat-aar
개발자가 더 이상 프로젝트를 지원하지 않음