惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
量子位
大猫的无限游戏
大猫的无限游戏
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
Google DeepMind News
Google DeepMind News
小众软件
小众软件
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
雷峰网
雷峰网
Jina AI
Jina AI
酷 壳 – CoolShell
酷 壳 – CoolShell

Nx Blog

Sharing Tailwind CSS Styles Across Apps in a Monorepo | Nx Blog How SiriusXM Stays Competitive by Iterating and Getting to Market Fast | Nx Blog Agentic Experience Is the New Developer Experience | Nx Blog Nx Joins the Linux Foundation and the Agentic AI Foundation | Nx Blog A Monorepo Is NOT a Monolith | Nx Blog Why we deleted (most of) our MCP tools | Nx Blog Teach Your AI Agent How to Work in a Monorepo | Nx Blog How Broadcom stays efficient and nimble with monorepos | Nx Blog Why Monorepos are King in the Age of AI | Nx Blog Nx 2026 Roadmap: Expanding Agent Autonomy, Improving Performance, Better Polyglot and More | Nx Blog End to End Autonomous AI Agent Workflows with Nx | Nx Blog Autonomous Agents at Scale | Nx Blog Scaling 700+ Projects: How Nx Became a 'No-Brainer' for Caseware | Nx Blog Configure Tailwind v4 with Angular in an Nx Monorepo | Nx Blog The Missing Multiplier for AI Agent Productivity | Nx Blog A Year of Nx Webinars | Nx Blog Wrapping Up 2025 | Nx Blog Nx 22.3 Release: Angular 21 Support, tsgo Compiler, and Prettier v3 | Nx Blog Nx Cloud Release: Agent Resource Usage | Nx Blog Nx Platform Outperforms DIY Cache by 5x | Nx Blog An Nx Carol: Past, Present, and Future of Your Monorepo | Nx Blog Nx 22.1 Release: Terminal UI on Windows, Storybook 10, Vitest 4, and more! | Nx Blog The Compounding Effect: How Nx Features Multiply Performance Gains | Nx Blog 10 Monorepo Myths Debunked: Separating Fact from Fiction | Nx Blog Nx Cloud Release: Enterprise Task Analytics | Nx Blog Watch and Rebuild Storybook Dependencies with Nx | Nx Blog Book - React for Enterprise: Timeless Architecture for Enterprise Apps | Nx Blog Beyond Remote Cache: Unlock 70% More CI Performance | Nx Blog Nx 22 Release: Expanding the build platform | Nx Blog What's the Point of Generating All This Code If You Can't Merge It? | Nx Blog
Getting Mobile Into Your Monorepo: Android + Nx | Nx Blog
Mike Hartington · 2025-07-31 · via Nx Blog

Ok, so we now have a Java project in our monorepo, sitting along side of our React frontend app. We can run each of these from the Nx CLI and have a really good experience. But we can take this further. Java isn't only just used for backend apps. You can use Java to build things like Android apps, and Android apps can be built via Gradle. So in theory you could have frontend, backend, and mobile all coming from one monorepo. Now, I'm going out on my own here. Nx doesn't have an official Nx plugin for native Android, but in a attempt to see what is possible, let's try it!

Android Setup

Ok, we aren't going to be using Java completely, instead we're going to use Kotlin which runs on the JVM. Kotlin's major feature is Jetpack Compose, a declarative approach to building interfaces for Android apps. We can then use Gradle to manage our dependencies and build the final apk for installation. But to get started, we do need the IDE of choice for Android development, Android Studio. Android Studio is built on top of IntelliJ so if you've that before, you should feel at home. The major changes here are to add some needed features to managing your Android SDK and virtual devices.

Once installed, we'll go through some setup which installs the Android SDK for us. When setup, we'll create a new project based on an Empty Activity template. A word of caution, there are several templates that are based on the older "Views" approach, which is an XML-based approach of building your UI. While this is still a valid way of building Android apps, Google has recommended folks use Jetpack Compose over the XML approach. Be sure to chose the templates that do no include "Views".

From here, we do have a bit of work to prepare our project. Out of the box, Android Studio creates what is called a "multi-module" project. This is similar to a monorepo, as we could have multiple Java/Kotlin based apps or libraries in one repo. However, since our goal is to incorporate this into our previous monorepo, we need to consolidate this into a single module project. To do this, we're going to move some files around and merge our Gradle files for the project and for the app module.

You really shouldn't need to do this, but for simplicity sake, we're doing it so we're not having to deal with Gradle's Composite Build.

Once built, let's just test a build inside of Android Studio to validate our app still builds and that Gradle has all the dependencies installed.

Bringing in Nx

From here, we can follow the same process we used when bringing our Spring Boot app over to an existing Nx workspace.

$ nx import ../mhartington/MyApplication

✔ Which branch do you want to import? · main
✔ Which directory do you want to import into this workspace? ·
? Where in this workspace should the code be imported into? › apps/android-frontend

Once imported, we do need to help Nx know about this project a bit more. For starter, we need a project.json in the root of the app:

{
  "name": "android-frontend",
  "root": "apps/android-frontend",
  "projectType": "application"
}

Then we need to modify the build.gradle.kt to include the Nx plugin. This is currently a bug in the import process, so this is temporary. Remember, this isn't technically fully supported, so there be dragons:

plugins {
+ id("dev.nx.gradle.project-graph") version "0.1.0"
  alias(libs.plugins.android.application)
  alias(libs.plugins.kotlin.android)
  alias(libs.plugins.kotlin.compose)
}

android {...}
dependencies {...}

+ allprojects {
+    apply {
+        plugin("dev.nx.gradle.project-graph")
+    }
+ }

Then one last thing is to cd into the project and run a Gradle build:

cd apps/android-frontend
./gradlew build
cd ../../

This just let's Gradle install the Nx plugin and sync all the dependencies.

We Got Android, Now What?

Ok, that was a bit of work, but we're getting closer. From here we want to be able to deploy to an emulator from nx, so let's see what tasks we have available to use:

nx show project android-frontend

There are a lot of tasks in here, and most of them are not too relevant for us. How ever, I do know that there is a task we can run, and specifically an installDebug task.

Behind the scenes, installDebug will build our app, and deploy it to any device or emulator we have running.

nx run android-frontend:installDebug

We do need to have an emulator open, so we can start one from Android Studio or if you have the Android SDK available from the command line, you can start it that way. With installDebug running, we should be able to see the app get installed to the emulator. We'll need to manually open it up, but it does install.

What’s Next

And that's it! It might seem not that impressive, but in the future, there could hypothetically be a dedicated Nx Android plugin that could handle starting your emulator and deploying your app. This could build on the Nx plugin for Gradle and really help Android developers work more closely with their colleagues on the web team. We got one last blog post this week for our Java developers, so be sure to check back tomorrow and we'll get our app shipped 🚀.


Learn more: