[안드로이드 모듈] 외부 종속 라이브러리 같이 배포
안드로이드 모듈(라이브러리)을 제작하고 배포하는 과정에서 모듈에서 사용했던 라이브러리를 외부 앱에서 불러올 수 없는 상황이 발생했다.
근데 이 라이브러리가 프로젝트 안에 aar 또는 jar의 형식으로 되어있는것이 아닌, implementation한 외부 종속 라이브러리 라는 점이다.
이를 해결하기 위해서는 외부 앱에서 내가 만든 라이브러리를 다운받아 sync 할 때 나의 라이브러리에서 사용된 외부 종속 라이브러리를 같이 다운받아 sync되게끔 해주어야 한다.
해결 방법은 아래와 같다.
gradle파일에서 publishing할 때 사용했던 라이브러리들을 pom파일에 dependency 로 넣어주면 되는데, 아래 코드를 publishing하는 gradle에 추가하면 된다.
pom.withXml {
def dependenciesNode = asNode().getAt('dependencies')[0] ?: asNode().appendNode('dependencies')
// Iterate over the implementation dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included in the pom.
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
'Android' 카테고리의 다른 글
Android Retrofit2 Request URL Path를 유동적으로..! (0) | 2020.12.24 |
---|---|
Android Studio 이전 버전 세팅 불러오는 방법 (0) | 2020.08.13 |
Cannot invoke setValue on a background thread 해결 방법 (0) | 2020.08.03 |
RecyclerView에 줄 라인 추가하기(Divider) (0) | 2020.07.27 |
Layout Inspector로 레이아웃 디버깅하기 (0) | 2020.06.01 |
댓글
이 글 공유하기
다른 글
-
Android Retrofit2 Request URL Path를 유동적으로..!
Android Retrofit2 Request URL Path를 유동적으로..!
2020.12.24 -
Android Studio 이전 버전 세팅 불러오는 방법
Android Studio 이전 버전 세팅 불러오는 방법
2020.08.13 -
Cannot invoke setValue on a background thread 해결 방법
Cannot invoke setValue on a background thread 해결 방법
2020.08.03 -
RecyclerView에 줄 라인 추가하기(Divider)
RecyclerView에 줄 라인 추가하기(Divider)
2020.07.27