OLD | NEW |
1 Adblock Plus Library for Android | 1 Adblock Plus Library for Android |
2 ================================ | 2 ================================ |
3 | 3 |
4 An Android library project, tests and demo application for AdblockWebView widget
. | 4 An Android library project, tests and demo application for AdblockWebView widget
. |
5 | 5 |
6 ## Updating the dependencies | 6 ## Updating the dependencies |
7 | 7 |
8 Adblock Plus for Android has dependencies that aren't in this repository. | 8 Adblock Plus for Android has dependencies that aren't in this repository. |
9 To update those, call: | 9 To update those, call: |
10 | 10 |
11 ./ensure_dependencies.py | 11 ./ensure_dependencies.py |
12 | 12 |
13 ## Library | 13 ## Library |
14 | 14 |
15 An Android library that provides the core functionality of Adblock Plus. | 15 An Android library that provides the core functionality of Adblock Plus. |
16 You can find it in the 'libadblockplus-android' directory. | 16 You can find it in the 'libadblockplus-android' directory. |
17 | 17 |
18 ### Building | 18 ### Building |
19 | 19 |
20 #### Requirements | 20 #### Requirements |
21 | 21 |
22 * [The Android SDK](https://developer.android.com/sdk) | 22 * [The Android SDK](https://developer.android.com/sdk) |
23 * Android SDK Build tools 25.0.0 | 23 * Android SDK Build tools 25.0.0 |
24 * [The Android NDK, 16b](https://developer.android.com/ndk) | 24 * [The Android NDK, 16b](https://developer.android.com/ndk) |
25 | 25 |
26 Edit 'buildToolsVersion' in 'build.gradle' files if necessary. | 26 Edit 'buildToolsVersion' in 'build.gradle' files if necessary. |
27 | 27 |
| 28 #### Building of libadblockplus |
| 29 |
| 30 First, we need to build `V8` required for `libadblockplus`. |
| 31 See `libadblockplus/README` or V8 documentation on how to build V8 or |
| 32 fetch precompiled one. Run in 'libadblockplus' directory: |
| 33 |
| 34 make TARGET_OS=android TARGET_ARCH=arm Configuration=release get-prebuilt-v8 |
| 35 |
| 36 Then we can build `libadblockplus`: |
| 37 |
| 38 make TARGET_OS=android TARGET_ARCH=arm Configuration=release |
| 39 |
28 #### Building from command-line | 40 #### Building from command-line |
29 | 41 |
30 In the project root directory create the file _local.properties_ and set | 42 In the project root directory create the file _local.properties_ and set |
31 _sdk.dir_ and _ndk.dir_ to where you installed it, e.g.: | 43 _sdk.dir_ and _ndk.dir_ to where you installed it, e.g.: |
32 | 44 |
33 sdk.dir = /some/where/sdk | 45 sdk.dir = /some/where/sdk |
34 ndk.dir = /some/where/ndk | 46 ndk.dir = /some/where/ndk |
35 | 47 |
36 In the project root directory run: | 48 In the project root directory run: |
37 | 49 |
(...skipping 20 matching lines...) Expand all Loading... |
58 Note | 70 Note |
59 | 71 |
60 [Configuration] Building project in /tmp | 72 [Configuration] Building project in /tmp |
61 | 73 |
62 output while building | 74 output while building |
63 | 75 |
64 ### Building with prebuilt shared V8 | 76 ### Building with prebuilt shared V8 |
65 | 77 |
66 This can be desired to use product's V8 (let's say Chromium) instead of built-in
V8. | 78 This can be desired to use product's V8 (let's say Chromium) instead of built-in
V8. |
67 Put prebuilt shared V8 library file(s) in ARCH directories and set `SHARED_V8_LI
B_FILENAMES` | 79 Put prebuilt shared V8 library file(s) in ARCH directories and set `SHARED_V8_LI
B_FILENAMES` |
68 environment variable before building. You can pass multiple filenames, separated
with space. | 80 environment variable and `SHARED_V8_LIB_DIR` before building. |
| 81 You can pass multiple filenames in `SHARED_V8_LIB_FILENAMES`, separated with spa
ce. |
69 Libadblockplus is required to be linked with that library file(s). | 82 Libadblockplus is required to be linked with that library file(s). |
70 | 83 |
71 For example: | 84 For example: |
72 | 85 |
73 SHARED_V8_LIB_FILENAMES=libv8.cr.so ./gradlew clean assemble | 86 SHARED_V8_LIB_FILENAMES=libv8.cr.so SHARED_V8_LIB_DIR="/tmp/shared_v8" ./gra
dlew clean assembleAbi_arm |
74 | 87 |
75 or | 88 or |
76 | 89 |
77 SHARED_V8_LIB_FILENAMES="libv8.cr.so libfoo.so" ./gradlew clean assemble | 90 SHARED_V8_LIB_FILENAMES="libv8.cr.so libv8_libbase.cr.so libv8_libplatform.c
r.so" SHARED_V8_LIB_DIR="/tmp/shared_v8" ./gradlew clean assembleAbi_arm |
78 | 91 |
79 for multiple library files. | 92 for multiple library files. |
80 | 93 |
81 Note | 94 Note |
82 | 95 |
83 [Configuration] Excluding shared v8 library libv8.cr.so from AAR | 96 [Configuration] Excluding shared v8 library libv8.cr.so from AAR |
84 ... | 97 ... |
85 [Configuration] Linking dynamically with shared v8 library ./libadblockplus-
binaries/android_armeabi-v7a/libv8.cr.so | 98 [Configuration] Linking dynamically with shared v8 library /tmp/shared_v8/re
lease/libv8.cr.so |
86 ... | 99 ... |
87 | 100 |
88 output while building. | 101 output while building. |
89 | 102 |
90 Set `SHARED_V8_LIB_DIR` environment variable as full absolute path to pass | |
91 specific directory instead of default one (`libadblockplus-android/jni/libadbloc
kplus-binaries`). | |
92 | |
93 ### Building for single ARCH | 103 ### Building for single ARCH |
94 | 104 |
95 By default libadblockplus-android is built for both ARM and x86 and it can be fi
ltered when | 105 By default libadblockplus-android is built for both ARM and x86 and it can be fi
ltered when |
96 building end-user android application. However sometimes it can be desired to bu
ild | 106 building end-user android application. However sometimes it can be desired to bu
ild |
97 "libadblockplus-android.aar" for single ARCH. | 107 "libadblockplus-android.aar" for single ARCH. |
98 | 108 |
99 Pass `abi_arm` or `abi_x86` to build it for single arch or `abi_all` for all ARC
Hs: | 109 Pass `abi_arm` or `abi_x86` to build it for single arch or `abi_all` for all ARC
Hs: |
100 | 110 |
101 `./gradlew clean assembleAbi_arm` | 111 `./gradlew clean assembleAbi_arm` |
102 | 112 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 272 |
263 ### Building | 273 ### Building |
264 | 274 |
265 Make sure _Library_ requirements are present. | 275 Make sure _Library_ requirements are present. |
266 | 276 |
267 In the project root directory run: | 277 In the project root directory run: |
268 | 278 |
269 ./gradlew assemble | 279 ./gradlew assemble |
270 | 280 |
271 This will generate *.apk in the 'libadblockplus-android-webviewapp/build/outputs
/apk/' directory. | 281 This will generate *.apk in the 'libadblockplus-android-webviewapp/build/outputs
/apk/' directory. |
OLD | NEW |