| 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 * Apache Ant |
| 13 * The Android SDK: http://developer.android.com/sdk/ | 14 * The Android SDK: http://developer.android.com/sdk/ |
| 14 | 15 |
| 16 ~~~~ |
| 17 $ sudo apt-get install ant git |
| 18 ~~~~ |
| 19 |
| 15 Check out the source code | 20 Check out the source code |
| 16 ------------------------- | 21 ------------------------- |
| 17 | 22 |
| 18 Follow the instructions [here](../download) for downloading the Skia source. | 23 Follow the instructions [here](../download) for downloading the Skia source. Mod
ify .gclient to add the following line to |
| 24 the bottom, and then run gclient sync again: |
| 25 |
| 26 target_os = ["android"] |
| 19 | 27 |
| 20 Inside your Skia checkout, `platform_tools/android` contains the Android setup | 28 Inside your Skia checkout, `platform_tools/android` contains the Android setup |
| 21 scripts, Android specific dependencies, and the Android Sample App. | 29 scripts, Android specific dependencies, and the Android Sample App. |
| 22 | 30 |
| 23 Setup the Android SDK | 31 Setup the Android SDK |
| 24 --------------------- | 32 --------------------- |
| 25 | 33 |
| 26 To finish setting up the Android SDK you need to download use the SDK to | 34 To finish setting up the Android SDK you need to download use the SDK to |
| 27 download the appropriate API level. To do this simply go to the directory | 35 download the appropriate API level. To do this simply go to the directory |
| 28 where you installed the SDK and run the following commands | 36 where you installed the SDK and run the following commands |
| (...skipping 19 matching lines...) Expand all Loading... |
| 48 Custom Android Build Script | 56 Custom Android Build Script |
| 49 --------------------------- | 57 --------------------------- |
| 50 | 58 |
| 51 The android_ninja script is a wrapper for the ninja command (provided by | 59 The android_ninja script is a wrapper for the ninja command (provided by |
| 52 depot_tools) and is specifically designed to work with the Skia's build | 60 depot_tools) and is specifically designed to work with the Skia's build |
| 53 system. To use the script you need to call it from Skia's trunk directory with | 61 system. To use the script you need to call it from Skia's trunk directory with |
| 54 the -d option plus any of the options or arguments you would normally pass to | 62 the -d option plus any of the options or arguments you would normally pass to |
| 55 ninja (see descriptions of some of the other flags here). | 63 ninja (see descriptions of some of the other flags here). |
| 56 | 64 |
| 57 export ANDROID_SDK_ROOT=/path/to/android/sdk | 65 export ANDROID_SDK_ROOT=/path/to/android/sdk |
| 58 export ANDROID_HOME=/path/to/android/sdk | |
| 59 export PATH=$PATH:/path/to/depot_tools | 66 export PATH=$PATH:/path/to/depot_tools |
| 60 | 67 |
| 61 cd skia | 68 cd skia |
| 62 ./platform_tools/android/bin/android_ninja -d nexus_10 # or nexus_7, galaxy_
nexus, etc... | 69 ./platform_tools/android/bin/android_ninja -d nexus_10 # or nexus_7, galaxy_
nexus, etc... |
| 63 | 70 |
| 64 The -d option enables the build system to target the build to a specific | 71 The -d option enables the build system to target the build to a specific |
| 65 architecture such as MIPS (generic), x86 (generic) and ARM (generic and device | 72 architecture such as MIPS (generic), x86 (generic) and ARM (generic and device |
| 66 specific flavors for Nexus devices). This in turn allows Skia to take | 73 specific flavors for Nexus devices). This in turn allows Skia to take |
| 67 advantage of specific device optimizations (e.g. NEON instructions). | 74 advantage of specific device optimizations (e.g. NEON instructions). |
| 68 | 75 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 approach will also produce the noisiest results. | 128 approach will also produce the noisiest results. |
| 122 | 129 |
| 123 # <input> is file/dir on device | 130 # <input> is file/dir on device |
| 124 ./platform_tools/android/bin/android_run_skia --release nanobench --skps <in
put> | 131 ./platform_tools/android/bin/android_run_skia --release nanobench --skps <in
put> |
| 125 | 132 |
| 126 Build and run SampleApp | 133 Build and run SampleApp |
| 127 ----------------------- | 134 ----------------------- |
| 128 | 135 |
| 129 The SampleApp on Android provides a simple UI for viewing sample slides and gm i
mages. | 136 The SampleApp on Android provides a simple UI for viewing sample slides and gm i
mages. |
| 130 | 137 |
| 131 BUILDTYPE=Debug ./platform_tools/android/bin/android_ninja -d $TARGET_DEVICE
SampleApp_APK | 138 BUILDTYPE=Debug ./platform_tools/android/bin/android_ninja -d $TARGET_DEVICE |
| 132 | 139 |
| 133 Then, install the app onto the device: | 140 Then, install the app onto the device: |
| 134 | 141 |
| 135 ./platform_tools/android/bin/android_install_app | 142 ./platform_tools/android/bin/android_install_app |
| 136 | 143 |
| 137 Finally to run the application you can either navigate to the Skia Samples | 144 Finally to run the application you can either navigate to the Skia Samples |
| 138 application using the application launcher on your device or from the command | 145 application using the application launcher on your device or from the command |
| 139 line. The command line option allows you to pass additional details to the | 146 line. The command line option allows you to pass additional details to the |
| 140 application (similiar to other operating system) that specify where to find | 147 application (similiar to other operating system) that specify where to find |
| 141 skp files and other resources. | 148 skp files and other resources. |
| 142 | 149 |
| 143 ./platform_tools/android/bin/android_launch_app --resourcePath /data/local/t
mp/resources | 150 ./platform_tools/android/bin/android_launch_app --resourcePath /data/local/t
mp/resources |
| 144 | 151 |
| 145 By default if no additional parameters are specified the app will use the defaul
t | 152 By default if no additional parameters are specified the app will use the defaul
t |
| 146 params... | 153 params... |
| 147 | 154 |
| 148 --resourcePath /data/local/tmp/skia_resoures | 155 --resourcePath /data/local/tmp/skia_resoures |
| 149 --pictureDir /data/local/tmp/skia_skp | 156 --pictureDir /data/local/tmp/skia_skp |
| 150 | 157 |
| 151 | |
| 152 Android Studio Support | |
| 153 ----------------------- | |
| 154 | |
| 155 You can also build and run SampleApp (and some other experimental apps) using An
droid | |
| 156 Studio. To create the project either select "import project" from the quickstar
t | |
| 157 screen or use File -> Open. In both cases you'll need to select ./platform_tool
s/android/apps | |
| 158 as the root directory of your project. | |
| 159 | |
| 160 Finally to be able to build within Android studio it needs to know the path to | |
| 161 ninja so you will need to add a properties file and populate it with the path | |
| 162 to depot_tools. The syntax and location of that file is... | |
| 163 | |
| 164 # | |
| 165 # file location: ./platform_tools/android/apps/gradle.properties | |
| 166 # | |
| 167 depot_tools.dir=<path_to_depot_tools> | |
| 168 | |
| 169 That should be all the setup you need. You should now be able to build and depl
oy | |
| 170 SampleApp on ARM, Intel, and MIPS devices. | |
| 171 | |
| 172 | |
| 173 Build tools | 158 Build tools |
| 174 ----------- | 159 ----------- |
| 175 | 160 |
| 176 The Android platform does not support skdiff at this time. | 161 The Android platform does not support skdiff at this time. |
| 177 | 162 |
| 178 Clean up all generated files | 163 Clean up all generated files |
| 179 ---------------------------- | 164 ---------------------------- |
| 180 | 165 |
| 181 make clean | 166 make clean |
| 182 | 167 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 194 # include additional arguments in quotes (e.g. "dm --nopdf") | 179 # include additional arguments in quotes (e.g. "dm --nopdf") |
| 195 ./platform_tools/android/bin/android_gdb_native dm | 180 ./platform_tools/android/bin/android_gdb_native dm |
| 196 | 181 |
| 197 # SAMPLE APP | 182 # SAMPLE APP |
| 198 # make sure you've installed the app on the device first | 183 # make sure you've installed the app on the device first |
| 199 ./platform_tools/android/bin/android_gdb_app | 184 ./platform_tools/android/bin/android_gdb_app |
| 200 | 185 |
| 201 When the gdb client is ready, insert a breakpoint, and continue to let the | 186 When the gdb client is ready, insert a breakpoint, and continue to let the |
| 202 program resume execution. | 187 program resume execution. |
| 203 | 188 |
| OLD | NEW |