Fixed issue #90
This commit is contained in:
parent
735bc64a2d
commit
d7c9730712
29
README.md
29
README.md
|
@ -41,7 +41,7 @@ Advantages compare with other docker-android projects
|
|||
List of Docker images
|
||||
---------------------
|
||||
|
||||
|OS |Android version |API |Browser |Browser version |Chromedriver version |Image |Size |
|
||||
|OS |Android |API |Browser |Browser version |Chromedriver |Image |Size |
|
||||
|:---|:---|:---|:---|:---|:---|:---|:---|
|
||||
|Linux|5.0.1|21|browser|37.0|2.12|butomo1989/docker-android-x86-5.0.1|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-x86-5.0.1.svg)](https://microbadger.com/images/butomo1989/docker-android-x86-5.0.1 "Get your own image badge on microbadger.com")|
|
||||
|Linux|5.1.1|22|browser|39.0|2.13|butomo1989/docker-android-x86-5.1.1|[![](https://images.microbadger.com/badges/image/butomo1989/docker-android-x86-5.1.1.svg)](https://microbadger.com/images/butomo1989/docker-android-x86-5.1.1 "Get your own image badge on microbadger.com")|
|
||||
|
@ -135,6 +135,13 @@ docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -
|
|||
|
||||
You can deactivate auto_record by changing the value to "False" in docker-compose file. e.g. change value to "False" in this [line].
|
||||
|
||||
### Language
|
||||
|
||||
You can change the language setting of Android Emulator on the fly by passing following environment variable:
|
||||
|
||||
- LANGUAGE="\<language>"
|
||||
- COUNTRY="\<country>"
|
||||
|
||||
### Docker-Compose
|
||||
|
||||
![][compose]
|
||||
|
@ -144,24 +151,10 @@ There is [example of compose file] to run complete selenium grid and docker-andr
|
|||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
### Google Play Services
|
||||
|
||||
The Google play services (v12.8.74) will be downloaded from [apklinker](https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b51570a214a8/com.google.android.gms_12.8.74-040700-204998136_12874026_MinAPI23_(x86)(nodpi)_apklinker.com.apk) in [utils bash file] file when emulator booted . you can edit [utils bash file] as you need any adb stuffs as the following to disable emulators animation to increase performance:
|
||||
### Google Play Services and Google Play Store
|
||||
|
||||
adb shell "settings put global window_animation_scale 0.0"
|
||||
adb shell "settings put global transition_animation_scale 0.0"
|
||||
adb shell "settings put global animator_duration_scale 0.0"
|
||||
|
||||
mount it as follow in docker-compose file :
|
||||
|
||||
volumes:
|
||||
- $PWD/videos:/tmp/video
|
||||
- $PWD/src/utils.sh:/root/src/utils.sh
|
||||
|
||||
or when run directly
|
||||
```bash
|
||||
docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -v $PWD/src/utils.sh:/root/src/utils.sh -v $PWD/example/sample_apk:/root/tmp -e DEVICE="Nexus 5" -e APPIUM=true -e CONNECT_TO_GRID=true -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 --name android-container butomo1989/docker-android-x86-8.1
|
||||
```
|
||||
The Docker "Android Emulator" images contain Google Play Service (v12.8.74) and Google Play Store (v11.0.50). Both applications are downloaded from [apklinker](https://www.apklinker.com/), so please be aware of it in case you use private/company account to that applications.
|
||||
|
||||
Build Android project
|
||||
---------------------
|
||||
|
@ -185,7 +178,7 @@ Proxy
|
|||
|
||||
You can enable proxy inside container by passing following environment variables:
|
||||
|
||||
- HTTP_PROXY="\<docker\_bridge\_ip\_address>"
|
||||
- HTTP_PROXY="\<language>docker\_bridge\_ip\_address>"
|
||||
- HTTPS_PROXY="\<docker\_bridge\_ip\_address>"
|
||||
- NO_PROXY="localhost"
|
||||
|
||||
|
|
|
@ -144,7 +144,8 @@ function build() {
|
|||
IMG_TYPE=google_apis
|
||||
BROWSER=browser
|
||||
else
|
||||
IMG_TYPE=google_apis_playstore
|
||||
#adb root cannot be run in IMG_TYPE=google_apis_playstore
|
||||
IMG_TYPE=google_apis
|
||||
BROWSER=chrome
|
||||
fi
|
||||
echo "[BUILD] IMAGE TYPE: $IMG_TYPE"
|
||||
|
|
26
src/utils.sh
26
src/utils.sh
|
@ -4,9 +4,9 @@ function wait_emulator_to_be_ready () {
|
|||
boot_completed=false
|
||||
while [ "$boot_completed" == false ]; do
|
||||
status=$(adb wait-for-device shell getprop sys.boot_completed | tr -d '\r')
|
||||
echo "Boot Status: $boot_completed"
|
||||
echo "Boot Status: $status"
|
||||
|
||||
if [ "$boot_completed" == "1" ]; then
|
||||
if [ "$status" == "1" ]; then
|
||||
boot_completed=true
|
||||
else
|
||||
sleep 1
|
||||
|
@ -14,17 +14,31 @@ function wait_emulator_to_be_ready () {
|
|||
done
|
||||
}
|
||||
|
||||
function install_google_play_service () {
|
||||
function change_language_if_needed() {
|
||||
if [ ! -z "${LANGUAGE// }" ] && [ ! -z "${COUNTRY// }" ]; then
|
||||
wait_emulator_to_be_ready
|
||||
adb install -r "/root/google_play_service.apk"
|
||||
echo "Languge will be changed to ${LANGUAGE}-${COUNTRY}"
|
||||
adb root && adb shell "setprop persist.sys.language $LANGUAGE; setprop persist.sys.country $COUNTRY; stop; start"
|
||||
echo "Language is changed!"
|
||||
fi
|
||||
}
|
||||
|
||||
function install_google_play () {
|
||||
wait_emulator_to_be_ready
|
||||
echo "Google Play Service will be installed"
|
||||
adb install -r "/root/google_play_services.apk"
|
||||
echo "Google Play Store will be installed"
|
||||
adb install -r "/root/google_play_store.apk"
|
||||
}
|
||||
|
||||
function disable_animation () {
|
||||
# this is for demonstration what other amazing staff can be done here
|
||||
# To improve performance
|
||||
adb shell "settings put global window_animation_scale 0.0"
|
||||
adb shell "settings put global transition_animation_scale 0.0"
|
||||
adb shell "settings put global animator_duration_scale 0.0"
|
||||
}
|
||||
|
||||
install_google_play_service
|
||||
change_language_if_needed
|
||||
sleep 1
|
||||
install_google_play
|
||||
disable_animation
|
||||
|
|
Loading…
Reference in a new issue