You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you build Android project on MacBook or other laptop, you may think your computer performance is not enough.
3
+
If you build Android project on MacBook or other laptops, you must think your computer performance is not enough. Your laptop battery is not enough as well. And you must spend a lot time on waiting it.
4
4
So you may want a powerful and portable workstation. It is impossible. But you can build on remote PC.
5
+
The trouble on me as well. But I have fixed it. I used to build with [Mainframer](https://github.com/buildfoundation/mainframer) on my powerful desktop.
6
+
It is a problem that Mainframer configuring is not simple. In case I want to build on a cloud service or a new computer, tremendous steps of configuration make me feel tired. Whereas a virtualization technology , such as `Docker` and `Kubernetes`, is very efficient that I've used it in everywhere.
7
+
In this repo, I make a docker image for a **builder server** that contains Android environment and [Mainframer](https://github.com/buildfoundation/mainframer). You can deploy a google cloud or amazon cloud server for your remote and powerful building. On the other hand, , you can run on your desktop in case you have a powerful/high-performance PC with your laptop under one LAN. It works on not only **terminal** but also **Android Studio**.
5
8
6
-
The trouble on me as well, I used to build with [Mainframer](https://github.com/buildfoundation/mainframer) on my desktop that is high-performance/powerful.
9
+
# Server configuration
10
+
<details><summary>click to expand</summary>
7
11
8
-
In this repo, I make a docker image with [Mainframer](https://github.com/buildfoundation/mainframer) to create a **builder server**. It works on not only **terminal** but also **Android Studio**.
12
+
First step is building docker image. In your terminal, run this command `docker build -t mainframer-docker .`
9
13
10
-
# Build server
11
-
In order to build the docker image run following command `docker build -t mainframer-docker .`
12
-
* The docker image is setup to build go, clang, gcc, buck, rust, gradle and gradle android projects. If you want to make your docker image smaller you can comment out what you don't need in the Dockerfile.
14
+
Last step is starting it: run `docker run --restart always -d -p 23:22 mainframer-docker`.
13
15
14
-
To run the docker image run `docker run -d -p 23:22 mainframer-docker`.
16
+
Now, if there is no error, run `docker container ls | grep mainframer-dockers` to detect if it is started. May everything is very well.
17
+
</details>
15
18
16
-
# Client
17
-
18
-
Beside the project specific setup we need 2 more things, an ssh-key in order to make communication between client and server easier to maintain. And a ssh config for our server.
19
+
# Client configuration
20
+
<details><summary>click to expand</summary>
21
+
Beside the project specific setup we need 2 more things, an ssh-key that is used to easily communicate between client and server. And a ssh configuring for our server.
@@ -36,7 +39,7 @@ Beside the project specific setup we need 2 more things, an ssh-key in order to
36
39
37
40
To SSH to the docker container: `ssh remote_builder`
38
41
39
-
For android you can now just copy the mainframer folder and rename it `.mainframer` and you should be go to run ` bash ./mainframer.sh ./gradlew assembleDebug`.
42
+
For android you can now just copy the mainframer folder and rename it `.mainframer` and you should run ` bash ./mainframer.sh ./gradlew assembleDebug`.
40
43
41
44
**And now enjoy faster builds**
42
45
@@ -47,67 +50,39 @@ For android you can now just copy the mainframer folder and rename it `.mainfram
47
50
### build with Android Studio
48
51
49
52
1. open Android Studio, then do these steps:
53
+
54
+
2. use Android studio to open your project.
50
55
51
-
1. click **Run → Edit Configuration → +**.
56
+
3. click **Run → Edit Configuration → +**.
52
57
53
-
1. select your **Android App**.
58
+
4. select your **Android App**.
54
59
55
-
1. name a new name, e.g. remote-build.
60
+
5. name a new name, e.g. remote-build.
56
61
57
-
1. in **Module**, select submodule name, may be `app`.
62
+
6. in **Module**, select submodule name, may be `app`.
58
63
59
-
1. in **Before Launch**, click **-** to delete `Gradle-aware Make`
64
+
7. in **Before Launch**, click **-** to delete `Gradle-aware Make`
60
65
61
-
1. in **Before Launch**, click **+**, add **Run External Tool**, input a new name,like `remote assembleDebug`.
66
+
8. in **Before Launch**, click **+**, add **Run External Tool**, input a new name,like `remote assembleDebug`.
62
67
63
68
64
-
1. in **Program**, input `bash`.
69
+
9. in **Program**, input `bash`.
65
70
66
-
1. in **Parameters** input `mainframer.sh ./gradlew :app:assembleDebug -Pandroid.enableBuildCache=true`
71
+
10. in **Parameters** input `mainframer.sh ./gradlew :app:assembleDebug -Pandroid.enableBuildCache=true`
67
72
68
-
1. in **Working directory** , input `$ProjectFileDir$`.
73
+
11. in **Working directory** , input `$ProjectFileDir$`.
69
74
70
75
76
+
</details>
71
77
72
78
### In addition
73
79
74
-
when you got the error:
75
-
```
76
-
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/xxx/.ssh/remote-builder.pub"
77
-
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
0 commit comments