1
1
#! /usr/bin/env sh
2
- # Copyright 2016 The Rust Project Developers. See the COPYRIGHT
3
- # file at the top-level directory of this distribution and at
4
- # http://rust-lang.org/COPYRIGHT.
5
- #
6
- # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7
- # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8
- # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9
- # option. This file may not be copied, modified, or distributed
10
- # except according to those terms.
11
2
12
3
set -ex
13
4
@@ -18,43 +9,56 @@ set -ex
18
9
# located in https://github.com/appunite/docker by just wrapping it in a script
19
10
# which apparently magically accepts the licenses.
20
11
21
- mkdir sdk
22
- curl --retry 5 https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -O
23
- unzip -d sdk sdk-tools-linux-4333796.zip
12
+ SDK=6609375
13
+ mkdir -p sdk/cmdline-tools
14
+ wget -q --tries=20 https://dl.google.com/android/repository/commandlinetools-linux-${SDK} _latest.zip
15
+ unzip -q -d sdk/cmdline-tools commandlinetools-linux-${SDK} _latest.zip
24
16
25
17
case " $1 " in
26
18
arm | armv7)
27
- abi=armeabi-v7a
19
+ api=24
20
+ image=" system-images;android-${api} ;default;armeabi-v7a"
28
21
;;
29
-
30
22
aarch64)
31
- abi=arm64-v8a
23
+ api=24
24
+ image=" system-images;android-${api} ;google_apis;arm64-v8a"
32
25
;;
33
-
34
26
i686)
35
- abi=x86
27
+ api=28
28
+ image=" system-images;android-${api} ;default;x86"
36
29
;;
37
-
38
30
x86_64)
39
- abi=x86_64
31
+ api=28
32
+ image=" system-images;android-${api} ;default;x86_64"
40
33
;;
41
-
42
34
* )
43
35
echo " invalid arch: $1 "
44
36
exit 1
45
37
;;
46
38
esac ;
47
39
40
+ # Try to fix warning about missing file.
41
+ # See https://askubuntu.com/a/1078784
42
+ mkdir -p /root/.android/
43
+ echo ' ### User Sources for Android SDK Manager' >> /root/.android/repositories.cfg
44
+ echo ' #Fri Nov 03 10:11:27 CET 2017 count=0' >> /root/.android/repositories.cfg
45
+
46
+ # Print all available packages
47
+ # yes | ./sdk/tools/bin/sdkmanager --list --verbose
48
+
48
49
# --no_https avoids
49
50
# javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
50
- yes | ./sdk/tools/bin/sdkmanager --licenses --no_https
51
- yes | ./sdk/tools/bin/sdkmanager --no_https \
52
- " emulator" \
53
- " platform-tools" \
54
- " platforms;android-24" \
55
- " system-images;android-24;default;$abi "
51
+ #
52
+ # | grep -v = || true removes the progress bar output from the sdkmanager
53
+ # which produces an insane amount of output.
54
+ yes | ./sdk/cmdline-tools/tools/bin/sdkmanager --licenses --no_https | grep -v = || true
55
+ yes | ./sdk/cmdline-tools/tools/bin/sdkmanager --no_https \
56
+ " emulator" \
57
+ " platform-tools" \
58
+ " platforms;android-${api} " \
59
+ " ${image} " | grep -v = || true
56
60
57
61
echo " no" |
58
- ./sdk/tools/bin/avdmanager create avd \
62
+ ./sdk/cmdline-tools/ tools/bin/avdmanager create avd \
59
63
--name " ${1} " \
60
- --package " system-images;android-24;default; $abi "
64
+ --package " ${image} " | grep -v = || true
0 commit comments