Build local gradle app on remote server in Android Studio
Asked Answered
A

1

17

The size of my current project including the dependencies is growing all the time, which means right now it takes around 2 minutes on my local machine to create the current gradle build.

We already have a CI system which is building on pushes, but is there also a way to use cloud-resources to build the local version and pull it back to the local machine for testing and debugging in the emulator or a connected device?

Yes a solution would be to buy a faster PC, but that doesn't really scale well as also our engineering team is growing all the time. So renting a cloudserver, which is doing the heavy CPU work would be a very economical option.

Adduct answered 21/9, 2016 at 15:19 Comment(1)
If your project's gradle building time is takes long, try building gradle in offline mode that will reduce the building time (for local machine). For second paragraph question don't need to get data back to local server, there are some plugins available for directly running on android emulator, search your CI plugins.Autogenesis
C
9
  1. We can use mainframer or Mirakle to move the build process to remote machine. Check this article for more detail. We can run Docker container in remote-machine along with mainframer. Check this.

The basic principle upon which they both operate is that they open an SSH connection to the build executor, perform an rsync of your development folder to copy across any changes (such as edited source files) to the executor, run the build, and then perform a second rsync to copy the changes (including the compiled APK) back to your development machine.

  1. We can take advantage of Gradle build-cache server. Gradle is using the build cache since November 2016 and saw a median build time reduction of 15%. Check this and this for more information.

The recommended setup for the build cache is that your continuous integration server populates the remote build cache with the artifacts of clean builds. Developers will just pull from the remote cache and push to a local build cache.

Hope this will help future users.

Cartan answered 31/10, 2019 at 10:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.