如何将多个AAR捆绑到maven

问题描述 投票:0回答:1

我有两个AAR,我想将它们打包成一个库并上传到maven。两个AAR相互依赖。图书馆的结构如下:

LibraryA
--- AAR1
--- AAR2 

库的build.gradle中的依赖项是

dependencies {
   compile project(':AAR1')
   compile project(':AAR2')
}

但是当我在一个新项目中使用LibraryA时。我收到错误,它找不到AAR1和AAR2错误信息如下:

Failed to resolve: AAR1 
Failed to resolve: AAR2

如果,我使用transitive = true

compile ('com.example.LibraryA:1.0.0@aar') {
   transitive=true
 }

错误是它无法在AAR1和AAR2中找到attr或主题资源。

任何建议将不胜感激

编辑:

LibraryA的settings.gradle

include ':app', 'AAR1', 'AAR2'
android gradle aar
1个回答
1
投票

库在您的maven存储库中,AAR1和AAR2也在maven存储库中吗? 1.将AAR1和AAR2发布到maven 2.将库发布到具有依赖关系的maven:

dependencies {
  compile 'com.example.AAR1:1.0.0'
  compile 'com.example.AAR2:1.0.0'
}

如果你不想这样做,也许你需要用https://github.com/adwiv/android-fat-aar做一个胖子

© www.soinside.com 2019 - 2024. All rights reserved.