【问题标题】:How to bundle multiple AARs to maven如何将多个 AAR 捆绑到 maven
【发布时间】:2018-01-02 14:33:45
【问题描述】:

我有两个 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 或主题资源。

任何建议将不胜感激

编辑:

LibraryA 的settings.gradle

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

【问题讨论】:

标签: android gradle aar


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-19
    • 2016-07-18
    • 2015-05-20
    • 1970-01-01
    • 2019-12-28
    • 1970-01-01
    • 2012-11-15
    • 2015-08-07
    相关资源
    最近更新 更多