[PYTHON] I just wrote a script to build Android on another machine

add to

2017-06-21 It is cooler to use this. gojuno / mainframer: Tool for remote builds . Sync project to remote machine, execute command, sync back . 2016-11-21 23:44 Supports testing 2016-11-14 13:12 Addition of execution method in the cloud

This article in 3 lines

Android has a heavy build. Since the CPU is 100%, the development machine cannot be used during that time. Build on another machine.

problem

Slow, slow, Android Studio build is slow. If you start building for the time being, it will be like this. Screen Shot 2016-11-03 at 23.52.31.png This continues for this long Screen Shot 2016-11-03 at 23.55.37.png During this time, you cannot enter the code in Android Studio. You can't browse. I have no choice but to read a book. Thanks to that, Tsundoku has decreased. But the delivery date is coming.

It can't be helped that the build is heavy. There is no choice but to leave it to Google. At least while building

I want to secure that time alone. Instead of accelerating the build, I focused on preventing the CPU resources of the development machine from being consumed during the build.

Heavy cause

Various things such as etc. overlapped and the build became heavier day by day. I think.

Countermeasure 1 Use Android Studio Plugin by volunteers

Building with Android Studio in the cloud to speed up development --Unyablog. This popular article will solve it! I tried it with, but it stopped working in Android Studio 2.2 ... Can I use 2.2 with a little tinkering? I thought, but I didn't understand at all ...

Countermeasure 2 Make sure that the development machine is not occupied because it does not have to be faster.

But this mechanism, you don't have to force it in Android Studio, you can use the shell. I thought it would be nice to use python fabric, so I made it. Also, since it costs money, I decided to build with mac mini because I had a surplus instead of the cloud.

Run on your PC

I wrote a script! https://gist.github.com/shikajiro/90cdbdac652cf37a563840d812d73c5b

Run in the cloud

@sys1yagi Seems to have built it on Google's cloud GCE. Onome Build an Android application with an instance of Google Compute Engine

Installation

  1. Put the above script file in the root directory of your project
  2. Set the ip address of another machine to build.
  3. Set the module name, flavor name, and debug status of the application to be built.
  4. Create an environment where you can build on another machine 5-1. $ fab build works like a normal build. After compiling and installing, Activity starts. You can also test with 5-2. $ fab test. The result is displayed in the browser. You can also $ fab android_test, $ fab test_all.

Script flow

  1. Copy the code under development to another free machine.
  2. Build on another machine.
  3. Bring the apk built from another machine and install it.
  4. Launch the app.

Measurement result

I measured the time it takes more than a normal build.

environment

place Line Indoor environment
Home development machine optical line Router-> wifi ->Machine
Machine by office optical line Router-> wifi ->Machine

Execution time

Next, I tried tethering with LTE.

environment

place Line Indoor environment
Cafe development machine LTE Android ->Tethering->Machine
Machine by office optical line Router-> wifi ->Machine

Execution time

After all apk download is slow. If you want speed, you should refrain from it. But it's great not to use the battery on the go! !!

Recommended Posts

I just wrote a script to build Android on another machine
I wrote a script to upload a WordPress plugin
I wrote a script to get a popular site in Japan
I wrote a script to combine the divided ts files
I wrote a script to get you started with AtCoder fast!
I wrote a function to load a Git extension script in Python
I wrote a script to extract a web page link in Python
I wrote a script to help goodnotes5 and Anki work together
I want to build a Python environment
I made a script to display emoji
I want to develop Android apps on Android
AtCoder writer I wrote a script to aggregate the contests for each writer
[To Twitter gentlemen] I wrote a script to convert .jpg-large to .jpg at once.
I tried to build a super-resolution method / ESPCN
I tried to build a super-resolution method / SRCNN ①
I tried to build a super-resolution method / SRCNN ③
I tried to build a super-resolution method / SRCNN ②
I wrote a script to revive the gulp watch that will die soon
Build a machine learning Python environment on Mac OS
I want to develop an Android application on Android (debugging)
I made a script to put a snippet in README.md
I want to find a popular package on PyPi
How to build a Django (python) environment on docker
I want to easily build a model-based development environment
[Go + Gin] I tried to build a Docker environment
I added a function to CPython (build & structure grasp)
How to build a Python environment on amazon linux 2
Build a machine learning environment natively on Windows 10 (x64)
"Stop committing Japanese files to git on Mac> <" For the time being, I wrote a script to search for incompatible Japanese files on Mac and Linux.
When I tried to build a Rails environment on WSL2 (Ubuntu 20.04LTS), I stumbled and fell.
I wrote a script to create a Twitter Bot development environment quickly with AWS Lambda + Python 2.7
Build a python machine learning study environment on macOS sierra
Build a machine learning environment on mac (pyenv, deeplearning, opencv)
I wrote a program quickly to study DI with Python ①
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
I wrote a script that splits the image in two
I made a script to say hello at my Koshien
Build a machine learning environment
I will publish a shell script created to reduce the trouble of creating LiveUSB on Linux
I want to automatically operate Chrome on Windows from a virtual machine (ubuntu) started using Vagrant
I tried to build a SATA software RAID configuration that boots the OS on Ubuntu Server
I tried to create a server environment that runs on Windows 10
I installed Taiga.IO on CentOS7 (I made a script while I was there)
A note I was addicted to when making a beep on Linux
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
I tried to register a station on the IoT platform "Rimotte"
I tried installing MySQL on a Linux virtual machine on OCI Compute
How to deploy a Django app on heroku in just 5 minutes
I want to create a machine learning service without programming! WebAPI
[AWS / Tello] Build a system to operate the drone on the cloud
Shell script to build pyenv environment on ubuntu in one shot
I made a POST script to create an issue on Github and register it in the Project
I wrote a book that allows you to learn machine learning implementations and algorithms in a well-balanced manner.
I made a CUI-based translation script (2)
I made a CUI-based translation script
Build a python3 environment on CentOS7
Python: I tried to make a flat / flat_map just right with a generator
I wrote a code to convert quaternions to z-y-x Euler angles in Python
I changed my job to a machine learning engineer at AtCoder Jobs
Try to infer using a linear regression model on android [PyTorch Mobile]
A story I was addicted to trying to install LightFM on Amazon Linux