1
+ sudo : required # disables container-based builds which have a maximum of 4GB of memory
2
+ language : android
3
+ jdk : oraclejdk8
4
+ env :
5
+ global :
6
+ - ADB_INSTALL_TIMEOUT=15 # wait up to 15 minutes for adb to connect to emulator (2 minutes by default)
7
+ - EMULATOR_ANDROID_VERSION=19
8
+ - BUILD_ANDROID_VERSION=28
9
+ - BUILD_TOOLS_VERSION=28.0.3
10
+ before_cache :
11
+ - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
12
+ - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
13
+ cache :
14
+ directories :
15
+ - $HOME/.gradle/caches/
16
+ - $HOME/.gradle/wrapper/
17
+ - $HOME/.android/build-cache
18
+ android :
19
+ components :
20
+ - tools # to get the new `repository-11.xml`
21
+ - tools # https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943)
22
+ - platform-tools
23
+ - build-tools-$BUILD_TOOLS_VERSION
24
+ - android-$BUILD_ANDROID_VERSION
25
+ - android-$EMULATOR_ANDROID_VERSION
26
+ - sys-img-armeabi-v7a-android-$EMULATOR_ANDROID_VERSION
27
+ licenses :
28
+ - ' android-sdk-license-.+'
29
+ before_install :
30
+ # List all available targets, device definitions and AVDs.
31
+ - sdkmanager --list || true
32
+
33
+ # Update sdk tools to latest version and install/update components
34
+ - yes | sdkmanager "tools" > /dev/null
35
+ - yes | sdkmanager "platform-tools" > /dev/null
36
+ - yes | sdkmanager "build-tools;$BUILD_TOOLS_VERSION" > /dev/null
37
+
38
+ - yes | sdkmanager "platforms;android-$EMULATOR_ANDROID_VERSION" > /dev/null
39
+ - yes | sdkmanager "platforms;android-$BUILD_ANDROID_VERSION" > /dev/null
40
+
41
+ # - yes | sdkmanager "system-images;android-24;google_apis;armeabi-v7a" > /dev/null
42
+
43
+ - yes | sdkmanager --update > /dev/null
44
+ - yes | sdkmanager --licenses > /dev/null
45
+
46
+ # Check components status
47
+ - sdkmanager --list || true
48
+
49
+ before_script :
50
+ # local.properties file is not checked in but required (an empty file is good enough)
51
+ - touch local.properties
52
+
53
+ # Make sure gradlew is executable
54
+ - chmod +x gradlew
55
+
56
+ # Create emulator and wait for it to start
57
+ - sdkmanager "system-images;android-$EMULATOR_ANDROID_VERSION;google_apis;armeabi-v7a"
58
+ - echo no | avdmanager -v create avd -f -n test -k "system-images;android-$EMULATOR_ANDROID_VERSION;google_apis;armeabi-v7a"
59
+ # Use new emulator executable location
60
+ - $ANDROID_HOME/emulator/emulator -avd test -no-audio -no-window &
61
+ - android-wait-for-emulator
62
+
63
+ # Turn off animations
64
+ - adb shell settings put global window_animation_scale 0 &
65
+ - adb shell settings put global transition_animation_scale 0 &
66
+ - adb shell settings put global animator_duration_scale 0 &
67
+
68
+ # Wake up
69
+ - adb shell input keyevent 82 &
70
+ - adb shell input keyevent 1 &
71
+
72
+ script :
73
+ - ./gradlew clean test --stacktrace
74
+
75
+ # Simpler config, but less up-to-date when it comes to tooling.
76
+ # Added here for historical reasons.
77
+ # language: android
78
+ # jdk: oraclejdk8
79
+ # android:
80
+ # components:
81
+ # - tools
82
+ # - platform-tools
83
+ # - build-tools-28.0.3
84
+ # - android-28
85
+ # - android-24
86
+ # - sys-img-armeabi-v7a-android-24
87
+ # licenses:
88
+ # - 'android-sdk-license-.+'
89
+ # before_install:
90
+ # - yes | sdkmanager "platforms;android-24"
91
+ # - yes | sdkmanager "platforms;android-28"
92
+ # - yes | sdkmanager "build-tools;28.0.3"
93
+ # before_script:
94
+ # local.properties file is not checked in but required (an empty file is good enough)
95
+ # - touch local.properties
96
+
97
+ # Make sure gradlew is executable
98
+ # - chmod +x gradlew
99
+
100
+ # Create emulator and wait for it to start
101
+ # - echo no | android create avd --force -n test -t android-24 --abi armeabi-v7a
102
+ # - emulator -avd test -no-skin -no-window &
103
+ # - android-wait-for-emulator
104
+ # - adb shell input keyevent 82 &
105
+
106
+ # before_cache:
107
+ # - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
108
+ # - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
109
+ # cache:
110
+ # directories:
111
+ # - $HOME/.gradle/caches/
112
+ # - $HOME/.gradle/wrapper/
113
+ # - $HOME/.android/build-cache
114
+ # script:
115
+ # - ./gradlew clean test --stacktrace
0 commit comments