mirror of
https://github.com/budtmo/docker-android.git
synced 2026-07-31 04:07:25 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7c9730712 | ||
|
|
735bc64a2d | ||
|
|
307d6502af | ||
|
|
91a4e270c6 |
@@ -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://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://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"
|
||||
|
||||
|
||||
+11
-1
@@ -90,13 +90,17 @@ ARG SYS_IMG=x86
|
||||
ARG IMG_TYPE=google_apis
|
||||
ARG BROWSER=android
|
||||
ARG CHROME_DRIVER=2.40
|
||||
ARG GOOGLE_PLAY_SERVICE=12.8.74
|
||||
ARG GOOGLE_PLAY_STORE=11.0.50
|
||||
ENV ANDROID_VERSION=$ANDROID_VERSION \
|
||||
API_LEVEL=$API_LEVEL \
|
||||
PROCESSOR=$PROCESSOR \
|
||||
SYS_IMG=$SYS_IMG \
|
||||
IMG_TYPE=$IMG_TYPE \
|
||||
BROWSER=$BROWSER \
|
||||
CHROME_DRIVER=$CHROME_DRIVER
|
||||
CHROME_DRIVER=$CHROME_DRIVER \
|
||||
GOOGLE_PLAY_SERVICE=$GOOGLE_PLAY_SERVICE \
|
||||
GOOGLE_PLAY_STORE=$GOOGLE_PLAY_STORE
|
||||
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
|
||||
|
||||
RUN yes | sdkmanager --licenses && \
|
||||
@@ -110,6 +114,12 @@ RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/${CHROME
|
||||
&& unzip -x chrome.zip \
|
||||
&& rm chrome.zip
|
||||
|
||||
#================================================================
|
||||
# Download Google Play Services APK and Play Store from apklinker
|
||||
#================================================================
|
||||
Run wget -nv -O google_play_services.apk "https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b5155e5ef4f8/com.google.android.gms_${GOOGLE_PLAY_SERVICE}-020700-204998136_12874013_MinAPI21_(x86)(nodpi)_apklinker.com.apk"
|
||||
Run wget -nv -O google_play_store.apk "https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b632b1164e31/com.android.vending_${GOOGLE_PLAY_STORE}-all-0-PR-206665793_81105000_MinAPI16_(armeabi,armeabi-v7a,mips,mips64,x86,x86_64)(240,320,480dpi)_apklinker.com.apk"
|
||||
|
||||
#================================================
|
||||
# noVNC Default Configurations
|
||||
# These Configurations can be changed through -e
|
||||
|
||||
+2
-1
@@ -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"
|
||||
|
||||
Regular → Executable
+34
-20
@@ -1,30 +1,44 @@
|
||||
#!/bin/bash
|
||||
BOOT ()
|
||||
{
|
||||
A=$(adb wait-for-device shell getprop sys.boot_completed | tr -d '\r')
|
||||
while [[ $A != "1" ]]; do
|
||||
sleep 1;
|
||||
A=$(adb wait-for-device shell getprop sys.boot_completed | tr -d '\r')
|
||||
done;
|
||||
|
||||
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: $status"
|
||||
|
||||
if [ "$status" == "1" ]; then
|
||||
boot_completed=true
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
Get_Google_Play_Services ()
|
||||
{
|
||||
wget "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"
|
||||
function change_language_if_needed() {
|
||||
if [ ! -z "${LANGUAGE// }" ] && [ ! -z "${COUNTRY// }" ]; then
|
||||
wait_emulator_to_be_ready
|
||||
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
|
||||
}
|
||||
|
||||
Update_Google_Play_Services ()
|
||||
{
|
||||
adb install -r "$PWD/com.google.android.gms_12.8.74-040700-204998136_12874026_MinAPI23_(x86)(nodpi)_apklinker.com.apk"
|
||||
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"
|
||||
}
|
||||
Disable_animations ()
|
||||
{
|
||||
# this is for demonstration what other amazing staff can be done here
|
||||
|
||||
function disable_animation () {
|
||||
# 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"
|
||||
}
|
||||
BOOT
|
||||
Get_Google_Play_Services
|
||||
Update_Google_Play_Services
|
||||
Disable_animations
|
||||
|
||||
change_language_if_needed
|
||||
sleep 1
|
||||
install_google_play
|
||||
disable_animation
|
||||
|
||||
Reference in New Issue
Block a user