开源软件名称(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
Build & publish AAR artifacts to local maven repository by using
./gradlew publishAarPublicationToMavenRepository -PuseAARForDevBuild=false
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
Add useAARForDevBuild=true
in your local.properties
(in your project's root directory)
Also specify modules on which you want to work, e.g. it should look like this
useAARForDevBuild=true
modules=:app :myawesomemodule1 :myawesomemodule2
Do gradle sync
Once sync is complete, check Android View
of project in Android Studio
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 ?
Add below in your project root level build.gradle
apply from: "$rootDir/gradle/local-aar-config.gradle"
apply from: "$rootDir/gradle/local-aar.gradle"
Also, specify local maven repo in your project root level build.gradle
maven { url = "$rootDir/localMavenRepository" }
Add below files to root level gradle
directory
gradle/local-aar.gradle
gradle/local-aar-config.gradle
gradle/publish.gradle
gradle/settings-helper.gradle
In your settings.gradle
, add below
apply from : " $rootDir /gradle/settings-helper.gradle"
In your settings.gradle
, replace included modules entries like this for all modules. e.g. replace
include ' :awesomeModule1'
with
includeIfEnabled(' :awesomeModule1' )
In your app modules build.gradle
files, add below
apply from : " $rootDir /gradle/local-aar.gradle"
In your library modules build.gradle
files, add below
apply from : " $rootDir /gradle/local-aar.gradle"
apply from : " $rootDir /gradle/publish.gradle"
Specify your dependencies path using customModulePath
method in your build.gradle
files. e.g. replace
implementation project(path : ' :myawesomemodule1' )
with
implementation customModulePath(' :myawesomemodule1' )
Add /localMavenRepository
in your .gitignore
Follow How to run this demo section for building with this approach.
请发表评论