OLD | NEW |
1 Sample Go application that can be loaded into a mojo shell running on Android. | 1 Sample Go application that can be loaded into a mojo shell running on Android. |
2 The application exports a MojoMain entry point for the shell and then makes | 2 The application exports a MojoMain entry point for the shell and then makes |
3 a GetTimeTicksNow system call. | 3 a GetTimeTicksNow system call. |
4 | 4 |
5 Setup instructions | 5 Setup instructions |
6 | 6 |
7 1) Generate the NDK toolchain for the android platform you plan to use. | 7 1) Generate the NDK toolchain for the android platform you plan to use. |
8 | 8 |
9 $ cd mojo/src/third_party/android_tools/ndk | 9 $ cd mojo/src/third_party/android_tools/ndk |
10 $ NDK_ROOT=$HOME/android/ndk-toolchain | 10 $ NDK_ROOT=$HOME/android/ndk-toolchain |
(...skipping 16 matching lines...) Expand all Loading... |
27 $ mojo/tools/mojob.py gn --android | 27 $ mojo/tools/mojob.py gn --android |
28 This should show an error 'assert(go_build_tool != "")', now run | 28 This should show an error 'assert(go_build_tool != "")', now run |
29 $ gn args out/android_Debug | 29 $ gn args out/android_Debug |
30 And append two lines: | 30 And append two lines: |
31 mojo_use_go=true | 31 mojo_use_go=true |
32 go_build_tool="<path_to_go_binary>" | 32 go_build_tool="<path_to_go_binary>" |
33 | 33 |
34 $ ninja -C out/android_Debug go_sample_app | 34 $ ninja -C out/android_Debug go_sample_app |
35 | 35 |
36 To run the app: | 36 To run the app: |
37 1) configure port forwarding 4444 -> localhost:4444 on android device or | 37 $ mojo/tools/android_mojo_shell.py --enable-multiprocess mojo:go_sample_app |
38 use 10.0.2.2 instead of 127.0.0.1 if you are running an android emulator | |
39 2) open new terminal and run | |
40 $ cd out/android_Debug | |
41 $ python -m SimpleHTTPServer 4444 | |
42 3) in the previous terminal run | |
43 $ mojo/tools/android_mojo_shell.py --url-mappings="mojo:go_sample_app"="http://1
27.0.0.1:4444/obj/mojo/go/go_sample_app" "mojo:go_sample_app" | |
44 | 38 |
45 More inforamtion about building mojo: https://github.com/domokit/mojo/blob/maste
r/README.md | 39 More inforamtion about building mojo: https://github.com/domokit/mojo/blob/maste
r/README.md |
OLD | NEW |