OLD | NEW |
1 Adblock Plus Library for Android | 1 Adblock Android SDK |
2 ================================ | 2 ================================ |
3 | 3 |
4 An Android library project, tests and demo application for AdblockWebView widget
. | 4 An Android library project, tests, settings fragments and demo application for A
dblockWebView. |
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 Android SDK 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 'adblock-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 from command-line | 28 #### Building from command-line |
29 | 29 |
30 In the project root directory create the file _local.properties_ and set | 30 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.: | 31 _sdk.dir_ and _ndk.dir_ to where you installed it, e.g.: |
32 | 32 |
33 sdk.dir = /some/where/sdk | 33 sdk.dir = /some/where/sdk |
34 ndk.dir = /some/where/ndk | 34 ndk.dir = /some/where/ndk |
35 | 35 |
36 In the project root directory run: | 36 In the project root directory run: |
37 | 37 |
38 ./gradlew assembleDebug | 38 ./gradlew assembleDebug |
39 | 39 |
40 This will generate *.aar library artifact in the 'libadblockplus-android/build/o
utputs/aar/' directory. | 40 This will generate *.aar library artifact in the 'adblock-android/build/outputs/
aar/' directory. |
41 | 41 |
42 **Android permissions note** | 42 **Android permissions note** |
43 | 43 |
44 An app that uses the library have to add the following permissions to `AndroidMa
nifest.xml`: | 44 An app that uses the library have to add the following permissions to `AndroidMa
nifest.xml`: |
45 * `<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>` | 45 * `<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>` |
46 * `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>` | 46 * `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>` |
47 | 47 |
48 (added automatically if building with Gradle or should be added manually otherwi
se). | 48 (added automatically if building with Gradle or should be added manually otherwi
se). |
49 | 49 |
50 ### Build directory configuration | 50 ### Build directory configuration |
(...skipping 30 matching lines...) Expand all Loading... |
81 Note | 81 Note |
82 | 82 |
83 [Configuration] Excluding shared v8 library libv8.cr.so from AAR | 83 [Configuration] Excluding shared v8 library libv8.cr.so from AAR |
84 ... | 84 ... |
85 [Configuration] Linking dynamically with shared v8 library ./libadblockplus-
binaries/android_armeabi-v7a/libv8.cr.so | 85 [Configuration] Linking dynamically with shared v8 library ./libadblockplus-
binaries/android_armeabi-v7a/libv8.cr.so |
86 ... | 86 ... |
87 | 87 |
88 output while building. | 88 output while building. |
89 | 89 |
90 Set `SHARED_V8_LIB_DIR` environment variable as full absolute path to pass | 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`). | 91 specific directory instead of default one (`adblock-android/jni/libadblockplus-b
inaries`). |
92 | 92 |
93 ### Building for single ARCH | 93 ### Building for single ARCH |
94 | 94 |
95 By default libadblockplus-android is built for both ARM and x86 and it can be fi
ltered when | 95 By default adblock-android is built for both ARM and x86 and it can be filtered
when |
96 building end-user android application. However sometimes it can be desired to bu
ild | 96 building end-user android application. However sometimes it can be desired to bu
ild |
97 "libadblockplus-android.aar" for single ARCH. | 97 "adblock-android.aar" for single ARCH. |
98 | 98 |
99 Pass `abi_arm` or `abi_x86` to build it for single arch or `abi_all` for all ARC
Hs: | 99 Pass `abi_arm` or `abi_x86` to build it for single arch or `abi_all` for all ARC
Hs: |
100 | 100 |
101 `./gradlew clean assembleAbi_arm` | 101 `./gradlew clean assembleAbi_arm` |
102 | 102 |
103 Note | 103 Note |
104 | 104 |
105 [Configuration] Using libadblockplus-android ABI flavor: abi_arm | 105 [Configuration] Using adblock-android ABI flavor: abi_arm |
106 | 106 |
107 output while building. | 107 output while building. |
108 | 108 |
109 ## Library tests | 109 ## Library tests |
110 | 110 |
111 Android tests for the library. | 111 Android tests for the library. |
112 You can find them in the 'libadblockplus-android-tests' directory. | 112 You can find them in the 'adblock-android-tests' directory. |
113 | 113 |
114 ### Requirements | 114 ### Requirements |
115 | 115 |
116 Make sure _Library_ requirements are present. | 116 Make sure _Library_ requirements are present. |
117 | 117 |
118 ### Building | 118 ### Building |
119 | 119 |
120 Make sure you've created the _local.properties_ file to build the library (see a
bove). | 120 Make sure you've created the _local.properties_ file to build the library (see a
bove). |
121 In the project root directory run: | 121 In the project root directory run: |
122 | 122 |
123 ./gradlew assembleDebugAndroidTest | 123 ./gradlew assembleDebugAndroidTest |
124 | 124 |
125 This will generate *.apk in the 'libadblockplus-android-tests/build/outputs/apk/
' directory. | 125 This will generate *.apk in the 'adblock-android-tests/build/outputs/apk/' direc
tory. |
126 | 126 |
127 ### Testing | 127 ### Testing |
128 | 128 |
129 You can select test class/method and click 'Run ..Test'. The library and test ap
p will be | 129 You can select test class/method and click 'Run ..Test'. The library and test ap
p will be |
130 compiled, installed to emulator/device and launched automatically. | 130 compiled, installed to emulator/device and launched automatically. |
131 | 131 |
132 ## Settings | 132 ## Settings |
133 | 133 |
134 An Android library that provides a configuration interface for Adblock Plus. | 134 An Android library that provides a configuration interface for Adblock Plus. |
135 You can find it in the 'libadblockplus-android-settings' directory: | 135 You can find it in the 'adblock-android-settings' directory: |
136 * GeneralSettingsFragment - main fragment | 136 * GeneralSettingsFragment - main fragment |
137 * WhitelistedDomainsSettingsFragment - whitelisted domains fragment | 137 * WhitelistedDomainsSettingsFragment - whitelisted domains fragment |
138 | 138 |
139 ### Usage | 139 ### Usage |
140 | 140 |
141 Create `AdblockEngineProvider` instance and `AdblockSettingsStorage` instance. | 141 Create `AdblockEngineProvider` instance and `AdblockSettingsStorage` instance. |
142 You can use `SharedPrefsStorage` implementation to store settings in `SharedPref
erences`. | 142 You can use `SharedPrefsStorage` implementation to store settings in `SharedPref
erences`. |
143 Or you can use AdblockHelper: | 143 Or you can use AdblockHelper: |
144 | 144 |
145 AdblockHelper | 145 AdblockHelper |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 AdblockHelper.get().getProvider().release(); | 200 AdblockHelper.get().getProvider().release(); |
201 | 201 |
202 Insert `GeneralSettingsFragment` fragment instance in runtime to start showing s
ettings UI. | 202 Insert `GeneralSettingsFragment` fragment instance in runtime to start showing s
ettings UI. |
203 | 203 |
204 ### Building | 204 ### Building |
205 | 205 |
206 In the project root directory run: | 206 In the project root directory run: |
207 | 207 |
208 ./gradlew assemble | 208 ./gradlew assemble |
209 | 209 |
210 This will generate *.aar in the 'libadblockplus-android-settings/build/outputs/a
ar' directory. | 210 This will generate *.aar in the 'adblock-android-settings/build/outputs/aar' dir
ectory. |
211 | 211 |
212 ## WebView | 212 ## WebView |
213 | 213 |
214 An Android library that provides a WebView component with Adblock Plus integrate
d. | 214 An Android library that provides a WebView component with Adblock Plus integrate
d. |
215 You can find it in the 'libadblockplus-android-webview' directory. | 215 You can find it in the 'adblock-android-webview' directory. |
216 | 216 |
217 `AdblockWebView` class provides built-in ad blocking | 217 `AdblockWebView` class provides built-in ad blocking |
218 (both resource loading filtering and element hiding) and inherits from Android | 218 (both resource loading filtering and element hiding) and inherits from Android |
219 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html)
. | 219 ['WebView'](https://developer.android.com/reference/android/webkit/WebView.html)
. |
220 | 220 |
221 ### Usage | 221 ### Usage |
222 | 222 |
223 In layout XML: | 223 In layout XML: |
224 | 224 |
225 <org.adblockplus.libadblockplus.android.webview.AdblockWebView | 225 <org.adblockplus.libadblockplus.android.webview.AdblockWebView |
(...skipping 20 matching lines...) Expand all Loading... |
246 | 246 |
247 Use `dispose(Runnable disposeFinished)` to release resources (**required**). | 247 Use `dispose(Runnable disposeFinished)` to release resources (**required**). |
248 Note it can be invoked from background thread. | 248 Note it can be invoked from background thread. |
249 | 249 |
250 ### Building | 250 ### Building |
251 | 251 |
252 In the project root directory run: | 252 In the project root directory run: |
253 | 253 |
254 ./gradlew assemble | 254 ./gradlew assemble |
255 | 255 |
256 This will generate *.aar in the 'libadblockplus-android-webview/build/outputs/aa
r' directory. | 256 This will generate *.aar in the 'adblock-android-webview/build/outputs/aar' dire
ctory. |
257 | 257 |
258 ## WebView Application | 258 ## WebView Application |
259 | 259 |
260 An Android application that demonstrates how to use AdblockWebView. | 260 An Android application that demonstrates how to use AdblockWebView. |
261 You can find it in the 'libadblockplus-android-webviewapp' directory. | 261 You can find it in the 'adblock-android-webviewapp' directory. |
262 | 262 |
263 ### Building | 263 ### Building |
264 | 264 |
265 Make sure _Library_ requirements are present. | 265 Make sure _Library_ requirements are present. |
266 | 266 |
267 In the project root directory run: | 267 In the project root directory run: |
268 | 268 |
269 ./gradlew assemble | 269 ./gradlew assemble |
270 | 270 |
271 This will generate *.apk in the 'libadblockplus-android-webviewapp/build/outputs
/apk/' directory. | 271 This will generate *.apk in the 'adblock-android-webviewapp/build/outputs/apk/'
directory. |
OLD | NEW |