You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user/languages/android.md
+59-29Lines changed: 59 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,25 +14,25 @@ Android builds are not available on the macOS environment.
14
14
15
15
### Overview
16
16
17
-
> Android builds are officially supported only on our Trusty Build environment at this time; hence, you'll need to explicitly specify `dist: trusty` in your .travis.yml file.
17
+
> Android builds are officially supported on our Bionic, Focal, and Jammy build environments; hence, you'll need to explicitly specify `dist: bionic`, `dist: focal`, or `dist: jammy` in your .travis.yml file.
18
18
19
19
Travis CI environment provides a large set of build tools for JVM languages with [multiple JDKs, Ant, Gradle, Maven](/user/languages/java/#overview), [sbt](/user/languages/scala/#projects-using-sbt) and [Leiningen](/user/languages/clojure/).
20
20
21
21
By setting
22
22
23
23
```yaml
24
24
language: android
25
-
dist: trusty
25
+
dist: focal # or dist: jammy, dist: bionic
26
26
```
27
27
{: data-file=".travis.yml"}
28
28
29
-
in your `.travis.yml` file, your project will be built in the Android environment which provides [Android SDK Tools](http://developer.android.com/tools/sdk/tools-notes.html) 25.2.3.
29
+
in your `.travis.yml` file, your project will be built in the Android environment which provides [Android SDK Tools](http://developer.android.com/tools/sdk/tools-notes.html).
30
30
31
31
Here is an example `.travis.yml` for an Android project:
32
32
33
33
```yaml
34
34
language: android
35
-
dist: trusty
35
+
dist: focal
36
36
android:
37
37
components:
38
38
# Uncomment the lines below if you want to
@@ -41,10 +41,10 @@ android:
41
41
# - platform-tools
42
42
43
43
# The BuildTools version used by your project
44
-
- build-tools-26.0.2
44
+
- build-tools-30.0.0
45
45
46
46
# The SDK version used to compile your project
47
-
- android-26
47
+
- android-30
48
48
49
49
# Additional components
50
50
- extra-google-google_play_services
@@ -53,7 +53,7 @@ android:
53
53
54
54
# Specify at least one system image,
55
55
# if you need to run emulator(s) during your tests
56
-
- sys-img-x86-android-26
56
+
- sys-img-x86-android-30
57
57
- sys-img-armeabi-v7a-android-17
58
58
```
59
59
{: data-file=".travis.yml"}
@@ -64,28 +64,60 @@ In your `.travis.yml`, you can define the list of SDK components to be installed
64
64
65
65
```yaml
66
66
language: android
67
-
dist: trusty
67
+
dist: focal
68
68
android:
69
69
components:
70
-
- build-tools-26.0.2
71
-
- android-26
72
-
- extra
70
+
- build-tools-30.0.0
71
+
- android-30
72
+
- extras;google;google_play_services
73
+
- extras;google;m2repository
74
+
- extras;android;m2repository
73
75
```
74
76
{: data-file=".travis.yml"}
75
77
76
78
The exact component names must be specified (filter aliases like `add-on` or `extra` are also accepted). To get a list of available exact component names and descriptions run the command `sdkmanager --list` (preferably in your local development machine).
77
79
80
+
Here are specific extra components you can install:
By default, Travis CI will accept all the requested licenses, but it is also possible to define a white list of licenses to be accepted, as shown in the following example:
81
113
82
114
```yaml
83
115
language: android
84
-
dist: trusty
116
+
dist: focal
85
117
android:
86
118
components:
87
-
- build-tools-26.0.2
88
-
- android-26
119
+
- build-tools-30.0.0
120
+
- android-30
89
121
- add-on
90
122
- extra
91
123
licenses:
@@ -103,22 +135,20 @@ While the following components are preinstalled, the exact list may change witho
103
135
104
136
- tools
105
137
- platform-tools
106
-
- build-tools-25.0.2
107
-
- android-25
108
-
- extra-google-google_play_services
109
-
- extra-google-m2repository
110
-
- extra-android-m2repository
138
+
- build-tools;30.0.0
139
+
- platforms;android-30
140
+
- extras;google;google_play_services
141
+
- extras;google;m2repository
142
+
- extras;android;m2repository
111
143
112
144
### Create and Start an Emulator
113
145
114
-
**Warning:** At the moment, these steps are not fully supported by Travis CI Android builder.
115
-
116
-
If you feel adventurous, you may use the script [`/usr/local/bin/android-wait-for-emulator`](https://github.com/travis-ci/travis-cookbooks/blob/precise-stable/ci_environment/android-sdk/files/default/android-wait-for-emulator) and adapt your `.travis.yml` to make this emulator available for your tests. For example:
146
+
If you need to use an emulator for your tests, you can use the script [`/usr/local/bin/android-wait-for-emulator`](https://github.com/travis-ci/travis-cookbooks/blob/precise-stable/ci_environment/android-sdk/files/default/android-wait-for-emulator) and adapt your `.travis.yml` to make this emulator available for your tests. For example:
117
147
118
148
```yaml
119
149
# Emulator Management: Create, Start and Wait
120
150
before_script:
121
-
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a -c 100M
151
+
- echo no | android create avd --force -n test -t android-30 --abi armeabi-v7a -c 100M
122
152
- emulator -avd test -no-audio -no-window &
123
153
- android-wait-for-emulator
124
154
- adb shell input keyevent 82 &
@@ -133,7 +163,7 @@ If your project is built with Ant or any other build tool that does not automati
133
163
134
164
```yaml
135
165
language: android
136
-
dist: trusty
166
+
dist: focal
137
167
install: ant deps
138
168
```
139
169
{: data-file=".travis.yml"}
@@ -198,9 +228,9 @@ As for any JVM language, it is also possible to [test against multiple JDKs](/us
198
228
199
229
For Android projects, `env` and `jdk` can be given as arrays to construct a build matrix.
200
230
201
-
## Build Android projects on new build environments
231
+
## Build Android projects on different build environments
202
232
203
-
The `dist: trusty` build environment is the only supported build environment for Android but if you would like to build on newer build environments e.g. `dist: jammy`, you can exercise your access to the Travis CI build environments and install required packages and tools. An example .travis.yml config can be reviewed below:
233
+
Android projects are supported on `dist: bionic`, `dist: focal`, and `dist: jammy` build environments. If you have specific requirements for other build environments, you can install required packages and tools as shown in this example:
0 commit comments