如何将多个 AAR 捆绑到 Maven

How to bundle multiple AARs to maven

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

LibraryA
--- AAR1
--- AAR2 

LibraryA 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 中找不到 aatr 或主题资源。

任何建议将不胜感激

编辑:

settings.gradle 图书馆 A

include ':app', 'AAR1', 'AAR2'

LibraryA 在你的maven 仓库中,AAR1 和AAR2 也在maven 仓库中吗? 1.将AAR1和AAR2发布到maven中 2. 将 LibraryA 重新发布到具有如下依赖项的 Maven 中:

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

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

做一个 fat-aar