Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Need some help #1

Closed
entwildfire opened this issue Jan 28, 2020 · 3 comments
Closed

Need some help #1

entwildfire opened this issue Jan 28, 2020 · 3 comments

Comments

@entwildfire
Copy link

Hi.
Thank you for your great work. I am new in docker, i want to use android emulator in docker to do some tasks. If you can help me if this possible or not and how to do this.
I want to install some application by default in emulator, and then install my application to read notification of the emulator device for some deadline time and then stop and remove the container.
I want to do this using docker API in Golang, so i don't need GUI at all, and just collect some data in a text file and then pull the file using adb in a short time. I need to my code (code to run android-container image in docker and communicate with the emulator using adb) run in another docker container.
So i want to run a container that run another container (emulator) and manage all of this and return my result.
My question:

  • Is this possible?
  • To read notification of a device i need to give notification access in setting manually to my app. How can i do this without GUI? Or can i install my apps and config the setting in GUI and then commit the container?

Thanks.

@phatnhse
Copy link
Owner

phatnhse commented Feb 1, 2020

What kind of notification settings? Is that your app's setting or system setting? I don't know your use case in particular but I probably guess not to use emulator (without GUI) in this case. Might be an API call, cronjob or a pipeline running in an exected time can help. Please elaborate more on it.

@entwildfire
Copy link
Author

entwildfire commented Feb 1, 2020

Notification Access is in android setting and need to set manually to an app.
I tried to fix my problem in another way. I installed an ubuntu in VM and then followed your steps to create an emulator, then i copied the /opt/android, /opt/gradle, /opt/gradlew, /root/.android folders.
Now i can build my docker image using this Dockerfile and get an emulator with my prepared config:

FROM ubuntu

LABEL maintainer "test@docker"

WORKDIR /

SHELL ["/bin/bash", "-c"]

RUN apt update && apt install -y openjdk-8-jdk vim git unzip libglu1 libpulse-dev libasound2 libc6  libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxi6  libxtst6 libnss3 wget

ARG GRADLE_VERSION=5.4.1
ARG ANDROID_API_LEVEL=28
ARG ANDROID_BUILD_TOOLS_LEVEL=28.0.3
ARG EMULATOR_NAME='test'

ADD opt /opt
ADD .android /root/.android

ENV GRADLE_HOME=/opt/gradle/gradle-$GRADLE_VERSION \
ANDROID_HOME=/opt/android
ENV PATH "$PATH:$GRADLE_HOME/bin:/opt/gradlew:$ANDROID_HOME/emulator:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools"
ENV LD_LIBRARY_PATH "$ANDROID_HOME/emulator/lib64:$ANDROID_HOME/emulator/lib64/qt/lib"

ADD start.sh /

RUN chmod +x start.sh

@phatnhse
Copy link
Owner

phatnhse commented Feb 1, 2020

I am glad to see you've managed to have them working.

I gonna close this issue.

Please re-open another issue if you find out any. Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants