deveshpatel-TW

deveshpatel-TW

Building Individual Libraries Through the Android Studio UI

I’m currently experimenting with Android Studio for a project that consists of multiple independent Android Library modules that internally use Kotlin, CMake and C++ code.

MyProject

-------------------------

app

Library1

Library2

Library3

-------------------------

Each library/module:

  • has its own build.gradle
  • has its own CMakeLists.txt
  • may have dependencies on other libraries/modules

What I would like to achieve is a simple UI-driven workflow inside Android Studio where a developer can select a particular library and build only that library.

Something conceptually like:

Libraries

--------------------

Library 1

Library 2

Library 3

--------------------

[BUILD]

--------------------

or through some existing Android Studio tool window/menu option that allows building individual libraries/modules.

Currently, I can invoke Gradle Tasks such as ‘:Library1:build’ from the terminal, which works fine.

First Post!

premsinghsodha7

premsinghsodha7

You can give each library a saved Gradle run configuration, so developers can select it from the toolbar and click Run. No custom plugin is needed.

  1. Open Run > Edit Configurations, click +, and choose Gradle.
  2. Select the root Gradle project.
  3. Set the task to :Library1:assembleDebug and name the configuration Build Library1 Debug.
  4. Apply it, select that configuration in the toolbar, and click Run. Repeat for the other libraries or variants.

Use :Library1:build instead if you want its broader build/check lifecycle, matching your terminal command. For producing a particular AAR, assembleDebug or assembleRelease keeps the intention clearer; flavor names change the task name.

You can also run tasks from View > Tool Windows > Gradle. Saved configurations are useful when the task tree is incomplete or you want a short list of named build actions.

“Only Library1” means its task and required dependencies. Gradle can still build another library that Library1 depends on. Its configured native build participates through the Android Gradle plugin; you do not need a separate UI action for each CMakeLists.txt.

References: Gradle run configurations, Android library/AAR builds.

Where Next?

Popular Android topics Top

Exadra37
I am in the process of research for my next technical blog about bypassing certificate pinning with Frida, thus I need to find some open ...
New
AndroidMan
I’ve tried signing up for Airnow as I used to do very well when they were Airpush, but i haven’t used them in years. I went through the s...
New
Shadow
Good afternoon. Brief story: My institution has several nfc tags in building which have to be scanned with specific app built and used in...
New
faust
Honest question, do companies still use Java for their new android apps? I thought everybody was using Kotlin these days.
New
skysnap
Helo, I’m using doubleviewpager in my project: Is there something similar that works with android x?
New
Garrett
This is a question about Android Studio. Where is the Android Studio emulator’s camera default apartment 3D model stored in Android Stud...
New
Devraj5032
I’m using TensorFlow Lite (TFLite) with React Native Expo. When I test the app using the Expo Go app, everything works fine. However, whe...
New
Alan
I need to create an android app to receive contactless payment from my clients. how can I start that? My clients will be phisicaly in the...
New
yosefk
I’m creating Hotspot network in Android by WifiManager.startLocalOnlyHotspot. It register the I/F in NetworkInterfaces but it does not i...
New
bee
Hi, I’d like a class that I can access from all activities / views, which is initialised once and not need to pass the reference. I gues...
New

Other popular topics Top

PragmaticBookshelf
Learn from the award-winning programming series that inspired the Elixir language, and go on a step-by-step journey through the most impo...
New
Exadra37
Please tell us what is your preferred monitor setup for programming(not gaming) and why you have chosen it. Does your monitor have eye p...
New
brentjanderson
Bought the Moonlander mechanical keyboard. Cherry Brown MX switches. Arms and wrists have been hurting enough that it’s time I did someth...
New
AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
PragmaticBookshelf
Author Spotlight Jamis Buck @jamis This month, we have the pleasure of spotlighting author Jamis Buck, who has written Mazes for Prog...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File > New Rule: And select Deny, O...
New
PragmaticBookshelf
Leverage Elixir and the Nx ecosystem to build intelligent applications that solve real-world problems in computer vision, natural languag...
New