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

akhgupta/AndroidLocalMavenRepoAARDemo

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

开源软件名称(OpenSource Name):

akhgupta/AndroidLocalMavenRepoAARDemo

开源软件地址(OpenSource Url):

https://github.com/akhgupta/AndroidLocalMavenRepoAARDemo

开源编程语言(OpenSource Language):

Java 61.9%

开源软件介绍(OpenSource Introduction):

This project demonstrates How we can improve Android build times & have better Android Studio performance using local maven repository approach.

Recommended for projects where we have more than one module.



Detailed info here

https://blog.gojekengineering.com/how-we-improved-performance-and-build-times-in-android-studio-306028166b79



How to run this demo ?


Publish local AAR artifacts

  1. Build & publish AAR artifacts to local maven repository by using
./gradlew publishAarPublicationToMavenRepository -PuseAARForDevBuild=false
  1. You should be able to see the folder name localMavenRepository in your root directory. As the name suggests, this is your local maven repository and you should be able to see all artifacts under it.

Specify dev modules to work on

  1. Add useAARForDevBuild=true in your local.properties (in your project's root directory)
  2. Also specify modules on which you want to work, e.g. it should look like this
useAARForDevBuild=true
modules=:app :myawesomemodule1 :myawesomemodule2
  1. Do gradle sync

  2. Once sync is complete, check Android View of project in Android Studio

  3. That's it, you can try adding / removing modules names and syncing same.



Demo Video

https://www.youtube.com/watch?v=rNT9eS5pO-g


How to integrate this approach in your app ?

  1. Add below in your project root level build.gradle
apply from: "$rootDir/gradle/local-aar-config.gradle"
apply from: "$rootDir/gradle/local-aar.gradle"
  1. Also, specify local maven repo in your project root level build.gradle
maven {   url = "$rootDir/localMavenRepository"   }
  1. Add below files to root level gradle directory
gradle/local-aar.gradle
gradle/local-aar-config.gradle
gradle/publish.gradle
gradle/settings-helper.gradle
  1. In your settings.gradle, add below
apply from: "$rootDir/gradle/settings-helper.gradle"
  1. In your settings.gradle, replace included modules entries like this for all modules. e.g. replace
include ':awesomeModule1'

with

includeIfEnabled(':awesomeModule1')
  1. In your app modules build.gradle files, add below
apply from: "$rootDir/gradle/local-aar.gradle"
  1. In your library modules build.gradle files, add below
apply from: "$rootDir/gradle/local-aar.gradle"
apply from: "$rootDir/gradle/publish.gradle"
  1. Specify your dependencies path using customModulePath method in your build.gradle files. e.g. replace
implementation project(path: ':myawesomemodule1')

with

implementation customModulePath(':myawesomemodule1')
  1. Add /localMavenRepository in your .gitignore
  2. Follow How to run this demo section for building with this approach.



鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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