• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

vigidroid/fat-aar-plugin: [DEPRECATED]A gradle plugin that helps to output fat a ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

vigidroid/fat-aar-plugin

开源软件地址(OpenSource Url):

https://github.com/vigidroid/fat-aar-plugin

开源编程语言(OpenSource Language):

Groovy 54.8%

开源软件介绍(OpenSource Introduction):

Deprecated

This repo is Deprecated. As the version of android gradle plugin keep increasing, I don't have enough time to keep supporting. And it stopped at 0.2.8, which supports android plugin at 2.2.3 and prior.

fat-aar-plugin

Download

This is a gradle plugin that helps to output fat aar from android library. I am inspired by android-fat-aar. And aim to make more flexible and functional. It's convenient to sdk developer(developer that provide a single aar library).

It works with the android gradle plugin, the android plugin's version of the development is 2.2.3, other revision is not tested actually. Commit an issue as you encounter some compatibility.

Update: Android plugin version 2.3.0 and later, is not well supported. disable build-cache may do the trick. So the recommend version is 2.2.3 and prior. Look this issue for more.

Essentially, fat-aar-plugin makes a hack way, to collect resources, jar files and something others in embedded dependencies, into the bundled output aar. Click here to know more about AAR.

[Features]

  • Support embed android library project, java project, android library and java library from maven repositories. Local jar file is not needed to use embed, compile is enough.
  • Work fine with the original features provided by android plugin. Such as multi build type, product flavor, manifest placeholder, proguard... If you find something wrong, commit an issue.
  • The jar files in embedded dependencies will be bundled into libs\ in aar when the proguard is off. Otherwise , they will be bundled into classes.jar in aar, it means classes in dependencies will also be obfuscated.

Getting Started

Step 1: Apply plugin

Add snippet below to your root build script file:

buildscript {
    repositories {
        maven {
            url  "http://dl.bintray.com/vigidroid/maven"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:xxx'
        classpath 'me.vigi:fat-aar-plugin:0.2.8'
    }
}

Add snippet below to the build.gradle of your android library:

apply plugin: 'me.vigi.fat-aar'

Step 2: Embed dependencies

change compile to embed while you want to embed the dependency in the library. Like this:

dependencies {
    // aar project
    embed project(':aar-lib')
    // java project
    embed project(':java-lib')
    // java dependency
    embed 'com.google.guava:guava:20.0'
    // aar dependency
    embed 'com.android.volley:volley:1.0.0'
  
    // other dependencies you don't want to embed in
    compile 'com.squareup.okhttp3:okhttp:3.6.0'
}

More usage see example.

About AAR File

AAR is a file format for android library. The file itself is a zip file that containing useful stuff in android. See anatomy of an aar file here.

support list for now:

  • manifest merge
  • classes jar and external jars merge
  • res merge
  • R.txt merge
  • assets merge
  • jni libs merge
  • proguard.txt merge
  • lint.jar merge
  • aidl merge?
  • public.txt merge?

Known Defects or Issues

  • Proguard note. Produce lots of(maybe) Note: duplicate definition of library class, while proguard is on. A workaround is to add -dontnote in proguard-rules.pro.
  • The overlay order of res merge is changed: Embedded dependency has higher priority than other dependencies.
  • Res merge conflicts. If the library res folder and embedded dependencies res have the same res Id(mostly string/app_name). A duplicate resources build exception will be thrown. To avoid res conflicts, consider using a prefix to each res Id, both in library res and aar dependencies if possible.
  • More issue or defect is welcomed...

Thanks

android-fat-aar




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
pedjak/gradle-dockerized-test-plugin: Running tests inside a docker image发布时间:2022-06-14
下一篇:
hal91190/gradletuto: Un court tutoriel Gradle发布时间:2022-06-14
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap