Skip to content

Commit c4e0fdb

Browse files
authored
Build instructions for Android (#15)
1 parent 624e254 commit c4e0fdb

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

Figures/android_build.png

42.4 KB
Loading

README.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,60 @@ Node-API contract from Node.js allows consumers of this library to interact with
77
JavaScript engine with a consistent interface. This library also provides some optional
88
polyfills that consumers can include if required.
99

10+
11+
## **Building - All Development Platforms**
12+
13+
**Required Tools:** [git](https://git-scm.com/), [CMake](https://cmake.org/), [node.js](https://nodejs.org/en/)
14+
15+
The first step for all development environments and targets is to clone this repository.
16+
17+
Use a git-enabled terminal to run the following command.
18+
19+
```
20+
git clone https://github.com/BabylonJS/JsRuntimeHost.git
21+
```
22+
23+
The unit tests require some NPM packages. From the root of the repository on the command line, run the following commands:
24+
25+
```
26+
cd Tests
27+
npm install
28+
```
29+
30+
31+
## **Building on Windows, Targeting Android**
32+
33+
_Follow the steps from [All Development Platforms](#all-development-platforms) before proceeding._
34+
35+
**Required Tools:**
36+
[Android Studio](https://developer.android.com/studio), [Node.js](https://nodejs.org/en/download/), [Ninja](https://ninja-build.org/)
37+
38+
The minimal requirement target is Android 5.0.
39+
40+
Only building with Android Studio is supported. CMake is not used directly. Instead, Gradle
41+
is used for building and CMake is automatically invocated for building the native part.
42+
An `.apk` that can be executed on your device or simulator is the output.
43+
44+
45+
First, download the latest release of Ninja, extract the binary, and add it to your system path.
46+
47+
Once you have Android Studio downloaded, you need to set up an Android emulator if you do not have a physical Android device. You can do this by selecting `Tools` -> `Device Manager` and then selecting a device. (We are using Pixel 2 API 27).
48+
49+
Open the project located at
50+
`JsRuntimeHost\Tests\UnitTests\Android` with Android Studio. Note that this can take a while to load. (The bottom right corner of the Android Studio window shows you what is currently being loaded.)
51+
52+
53+
Then in the LEFT PANE, right click on `app`, and select `Run 'All Tests'`, as displayed in the image below.
54+
55+
![Run All Tests](./Figures/android_build.png)
56+
57+
If you don't have an Android device plugged in or no Android image in the Android emulator, that option will be greyed and inaccessible.
58+
59+
**Troubleshooting:**
60+
If the `app\cpp` folder on the left navigation pane is empty, select `File` -> `Sync Project with Gradle Files` and try to re-run the project by selecting `Run` -> `Run 'All Tests'`.
61+
62+
Sometimes, you may need to clean the build. To do that, delete the `Debug` folder located at `JsRuntimeHost\Build\Android\Debug`.
63+
1064
## Contributing
1165

1266
Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for details on our code of conduct, and
@@ -19,4 +73,4 @@ Security Response Center (MSRC) at [[email protected]](mailto:secure@microsof
1973
You should receive a response within 24 hours. If for some reason you do not, please
2074
follow up via email to ensure we received your original message. Further information,
2175
including the [MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can
22-
be found in the [Security TechCenter](https://technet.microsoft.com/en-us/security/default).
76+
be found in the [Security TechCenter](https://technet.microsoft.com/en-us/security/default).

0 commit comments

Comments
 (0)