使用依赖项构建AAR

卡米尔克斯

我想建立带有依赖项的.AAR。我一直在寻找很多东西,但没有用。话题太老了。我意识到,结果.AAR应该在里面包含classes.jar,并且存在带有.class文件的目录。但是我不知道如何在gradle中自动执行此过程。

沃西切·布加吉(Wojciech Bugaj)

我们设法使用此Mobbeel fat AAR Gradle插件来做到这一点:https : //github.com/Mobbeel/fataar-gradle-plugin

    buildscript {
        repositories {
            //...
            maven {
                url 'https://plugins.gradle.org/m2/'
            }
        }
    }

    //...

    dependencies {
        classpath 'gradle.plugin.com.mobbeel.plugin:mobbeel-fataar:1.2.0'
    }

用标记依赖关系,api而不是implementation

    apply plugin: 'com.mobbeel.plugin'

    dependencies {
        api 'org.greenrobot:eventbus:3.0.0'
        //...
    }

    fatAARConfig {
        includeAllInnerDependencies false
    }

这篇文章很有帮助:http : //wittchen.io/2018/10/02/creating-fat-aar/

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章