OLD | NEW |
---|---|
1 Android | 1 Android |
2 ======= | 2 ======= |
3 | 3 |
4 Prerequisites | 4 Prerequisites |
5 ------------- | 5 ------------- |
6 | 6 |
7 _Currently we only support building Skia for Android on a Linux or Mac host! In addition, | 7 _Currently we only support building Skia for Android on a Linux or Mac host! In addition, |
8 we only use the Mac build for local development. All shipping variants are comp iled on | 8 we only use the Mac build for local development. All shipping variants are comp iled on |
9 Linux for performance reasons._ | 9 Linux for performance reasons._ |
10 | 10 |
11 The following libraries/utilities are required in addition to those needed for a standard skia checkout: | 11 The following libraries/utilities are required in addition to those needed for a standard skia checkout: |
12 | 12 |
13 * The Android SDK: http://developer.android.com/sdk/ | 13 * The Android SDK: http://developer.android.com/sdk/ |
14 | 14 |
15 Check out the source code | 15 Check out the source code |
16 ------------------------- | 16 ------------------------- |
17 | 17 |
18 Follow the instructions [here](../download) for downloading the Skia source. | 18 Follow the instructions [here](../download) for downloading the Skia source. |
19 | 19 |
20 Inside your Skia checkout, `platform_tools/android` contains the Android setup | 20 Inside your Skia checkout, `platform_tools/android` contains the Android setup |
21 scripts, Android specific dependencies, and the Android Sample App. | 21 scripts, Android specific dependencies, and the Android Viewer App. |
22 | 22 |
23 You may need to [install other dependencies](./linux#prerequisites): | 23 You may need to [install other dependencies](./linux#prerequisites): |
24 | 24 |
25 tools/install_dependencies.sh | 25 tools/install_dependencies.sh |
26 | 26 |
27 Setup the Android SDK | 27 Setup the Android SDK |
28 --------------------- | 28 --------------------- |
29 | 29 |
30 To finish setting up the Android SDK you need to download use the SDK to | 30 To finish setting up the Android SDK you need to download use the SDK to |
31 download the appropriate API level. To do this simply go to the directory | 31 download the appropriate API level. To do this simply go to the directory |
32 where you installed the SDK and run the following commands | 32 where you installed the SDK and run the following commands |
33 | 33 |
34 # You may want to add this export to your shell's .bash_profile or .profile | 34 # You may want to add this export to your shell's .bash_profile or .profile |
35 export ANDROID_SDK_ROOT=/path/to/android/sdk | 35 export ANDROID_SDK_ROOT=/path/to/android/sdk |
36 | 36 |
37 $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --filter android-19 | 37 $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --filter android-19 |
38 $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --filter android-23 | 38 $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --filter android-23 |
39 $ANDROID_SDK_ROOT/tools/android update sdk -a -u -t 8 | 39 $ANDROID_SDK_ROOT/tools/android update sdk -a -u -t 8 |
40 | 40 |
41 From here you will need to type 'y' to approve the license agreement and that | 41 From here you will need to type 'y' to approve the license agreement and that |
42 is all. You will then have downloaded the SDK for API level 19 and 23(Android 4 .4 | 42 is all. You will then have downloaded the SDK for API level 19 and 23(Android 4 .4 |
43 KitKat and Android 6.0 Marshmallow) which will be used to build the Skia SampleA pp. | 43 KitKat and Android 6.0 Marshmallow) which will be used to build the Skia Viewer app. |
44 You can download as many other Android add-ons or APIs as you want, but you only | 44 You can download as many other Android add-ons or APIs as you want, but you only |
45 are required to have these two in order to complete the Skia build process. | 45 are required to have these two in order to complete the Skia build process. |
46 | 46 |
47 The last line in the script installs Android SDK Build-tools 22.0.1. | 47 The last line in the script installs Android SDK Build-tools 22.0.1. |
48 Alternatively you can download the above packages with Android Studio, by clicki ng | 48 Alternatively you can download the above packages with Android Studio, by clicki ng |
49 the Launch Standalone SDK Manager link in Tools > Android > SDK Manger. | 49 the Launch Standalone SDK Manager link in Tools > Android > SDK Manger. |
50 | 50 |
51 Setup Environment for Android | 51 Setup Environment for Android |
52 ----------------------------- | 52 ----------------------------- |
53 | 53 |
54 The Android build needs to set up some specific variables needed by both GYP | 54 The Android build needs to set up some specific variables needed by both GYP |
55 and Make. We make this setup easy for developers by encapsulating all the | 55 and Make. We make this setup easy for developers by encapsulating all the |
56 details into a custom script that acts as a replacement for make. | 56 details into a custom script that acts as a replacement for make. |
57 | 57 |
58 Syncing the Source | 58 Syncing the Source |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 | 127 |
128 ./platform_tools/android/bin/[linux/mac]/adb push ../skp <dst> # <dst> is di r on device | 128 ./platform_tools/android/bin/[linux/mac]/adb push ../skp <dst> # <dst> is di r on device |
129 | 129 |
130 Finally to run the executable there are two approaches. The simplest of the | 130 Finally to run the executable there are two approaches. The simplest of the |
131 two run the app on the device like you would do for gm or tests, however this | 131 two run the app on the device like you would do for gm or tests, however this |
132 approach will also produce the noisiest results. | 132 approach will also produce the noisiest results. |
133 | 133 |
134 # <input> is file/dir on device | 134 # <input> is file/dir on device |
135 ./platform_tools/android/bin/android_run_skia --release nanobench --skps <in put> | 135 ./platform_tools/android/bin/android_run_skia --release nanobench --skps <in put> |
136 | 136 |
137 Build and run SampleApp | 137 Build and run Viewer App |
138 ----------------------- | 138 ----------------------- |
139 | 139 |
140 The SampleApp on Android provides a simple UI for viewing sample slides and gm i mages. | 140 The Viewer App on Android provides a simple UI for viewing sample slides and gm images. |
141 | 141 |
142 BUILDTYPE=Debug ./platform_tools/android/bin/android_ninja -d $TARGET_DEVICE SampleApp_APK | 142 BUILDTYPE=Debug ./platform_tools/android/bin/android_ninja -d $TARGET_DEVICE Viewer_APK |
143 | 143 |
144 Then, install the app onto the device: | 144 Then, install the app onto the device: |
145 | 145 |
146 ./platform_tools/android/bin/android_install_app | 146 ./platform_tools/android/bin/android_install_app |
147 | 147 |
148 Finally to run the application you can either navigate to the Skia Samples | 148 Finally to run the application you can either navigate to the Skia Viewer |
149 application using the application launcher on your device or from the command | 149 application using the application launcher on your device or from the command |
150 line. The command line option allows you to pass additional details to the | 150 line. The command line option allows you to pass additional details to the |
151 application (similar to other operating system) that specify where to find | 151 application (similar to other operating system) that specify where to find |
152 skp files and other resources. | 152 skp files and other resources. For example: |
153 | 153 |
154 ./platform_tools/android/bin/android_launch_app --resourcePath /data/local/t mp/resources | 154 ./platform_tools/android/bin/android_launch_app --resources /data/local/tmp/ skia |
jvanverth1
2016/07/12 14:23:47
I don't know if this matters, but the option in Vi
liyuqian
2016/07/12 17:44:58
Thanks, you're right. I'm sending another CL (http
| |
155 | 155 |
156 By default if no additional parameters are specified the app will use the defaul t | 156 By default if no additional parameters are specified the app will also have the following |
157 parameters... | 157 default parameters: |
158 | 158 |
159 --resourcePath /data/local/tmp/skia_resoures | 159 --skps /data/local/tmp/skia |
160 --pictureDir /data/local/tmp/skia_skp | 160 --jpgs /data/local/tmp/skia |
161 | 161 |
162 | 162 |
163 Android Studio Support | 163 Android Studio Support |
164 ----------------------- | 164 ----------------------- |
165 | 165 |
166 You can also build and run SampleApp (and some other experimental apps) using An droid | 166 You can also build and run Viewer App (and some other experimental apps) using A ndroid |
167 Studio. To create the project either select "import project" from the quickstar t | 167 Studio. To create the project either select "import project" from the quickstar t |
168 screen or use File -> Open. In both cases you'll need to select ./platform_tool s/android/apps | 168 screen or use File -> Open. In both cases you'll need to select ./platform_tool s/android/apps |
169 as the root directory of your project. | 169 as the root directory of your project. |
170 | 170 |
171 Finally to be able to build within Android studio it needs to know the path to | 171 Finally to be able to build within Android studio it needs to know the path to |
172 ninja so you will need to add a properties file and populate it with the path | 172 ninja so you will need to add a properties file and populate it with the path |
173 to depot_tools. The syntax and location of that file is... | 173 to depot_tools. The syntax and location of that file is... |
174 | 174 |
175 # | 175 # |
176 # file location: ./platform_tools/android/apps/gradle.properties | 176 # file location: ./platform_tools/android/apps/gradle.properties |
177 # | 177 # |
178 depot_tools.dir=<path_to_depot_tools> | 178 depot_tools.dir=<path_to_depot_tools> |
179 | 179 |
180 That should be all the setup you need. You should now be able to build and depl oy | 180 That should be all the setup you need. You should now be able to build and depl oy |
181 SampleApp on ARM, Intel, and MIPS devices. | 181 Viewer App on ARM, Intel, and MIPS devices. |
182 | 182 |
183 | 183 |
184 Build tools | 184 Build tools |
185 ----------- | 185 ----------- |
186 | 186 |
187 The Android platform does not support skdiff at this time. | 187 The Android platform does not support skdiff at this time. |
188 | 188 |
189 Clean up all generated files | 189 Clean up all generated files |
190 ---------------------------- | 190 ---------------------------- |
191 | 191 |
192 make clean | 192 make clean |
193 | 193 |
194 Debugging on Android | 194 Debugging on Android |
195 -------------------- | 195 -------------------- |
196 | 196 |
197 We support 2 modes of debugging on Android using GDB wrapper scripts. These | 197 We support 2 modes of debugging on Android using GDB wrapper scripts. These |
198 scripts start a gdbserver instance on the device and then enter an interactive | 198 scripts start a gdbserver instance on the device and then enter an interactive |
199 GDB client shell on your host. All necessary symbol files should | 199 GDB client shell on your host. All necessary symbol files should |
200 be pulled from the device and placed into a temporary folder (android_gdb_tmp). | 200 be pulled from the device and placed into a temporary folder (android_gdb_tmp). |
201 | 201 |
202 Note: The debugging scripts do not build the app - you'll have to do that first. | 202 Note: The debugging scripts do not build the app - you'll have to do that first. |
203 | 203 |
204 # COMMAND LINE APPS | 204 # COMMAND LINE APPS |
205 # include additional arguments in quotes (e.g. "dm --nopdf") | 205 # include additional arguments in quotes (e.g. "dm --nopdf") |
206 ./platform_tools/android/bin/android_gdb_native dm | 206 ./platform_tools/android/bin/android_gdb_native dm |
207 | 207 |
208 # SAMPLE APP | 208 # VIEWER APP |
209 # make sure you've installed the app on the device first | 209 # make sure you've installed the app on the device first |
210 ./platform_tools/android/bin/android_gdb_app [-d device_id] | 210 ./platform_tools/android/bin/android_gdb_app [-d device_id] |
211 | 211 |
212 When the gdb client is ready, insert a breakpoint, and continue to let the | 212 When the gdb client is ready, insert a breakpoint, and continue to let the |
213 program resume execution. | 213 program resume execution. |
OLD | NEW |