Insomniac icon indicating copy to clipboard operation
Insomniac copied to clipboard

Add feature to log in

Open mv-debug opened this issue 4 years ago • 36 comments

I use your code within a simulated android environment in docker. It could up automatically till the point of log in in the app. For CD purpose this feature will be nice to automatic log in(also handle multiple accounts in the app make sense). If you want I could create the Dockerfile for this feature.

mv-debug avatar Oct 30 '20 10:10 mv-debug

What simulated android environment do you have?

markbookk avatar Oct 30 '20 18:10 markbookk

What simulated android environment do you have?

You can use different devices and different os versions. I used this docker image as a base image: https://github.com/budtmo/docker-android. It worked like a charm on an older laptop with 4 cores and 8gb ram with two android container (for two accounts).

mv-debug avatar Oct 31 '20 08:10 mv-debug

Thanks for this resource, it looks awesome! I will give it a try.

markbookk avatar Nov 02 '20 01:11 markbookk

@alexal1 What do you think about the idea to deploy this framework in docker with a ready to go android setup?

mv-debug avatar Nov 02 '20 07:11 mv-debug

Thanks for this resource, it looks awesome! I will give it a try.

Do give it a try?

mv-debug avatar Nov 04 '20 13:11 mv-debug

I just tried it and it looks like it is working but the emulator doesn't have Google Play Store... What did you use to download Instagram app? Also, do you have Discord? I am not sure if we should keep talking about this here as it not the main issue.

markbookk avatar Nov 09 '20 04:11 markbookk

@mv-debug Could Could you give more information on how to make it work please?

@markbookk thanks for trying it, when its posible i will give a try! Sharing content here is a good way to everyone learn about it 👍

future2back avatar Nov 09 '20 04:11 future2back

I just tried it and it looks like it is working but the emulator doesn't have Google Play Store... What did you use to download Instagram app? Also, do you have Discord? I am not sure if we should keep talking about this here as it not the main issue.

You could use adb to install an app. And you could download apps on some free platforms. Is it allowed to name it here, I will try: https://www.apkmirror.com/apk/instagram/instagram-instagram/instagram-instagram-139-0-0-33-121-release/instagram-139-0-0-33-121-12-android-apk-download/

It is important to use the x86 architecture - if you use docker on amd64 or x86 processor.

I do not have discord, sorry.

mv-debug avatar Nov 09 '20 10:11 mv-debug

@mv-debug Could Could you give more information on how to make it work please?

@markbookk thanks for trying it, when its posible i will give a try! Sharing content here is a good way to everyone learn about it +1

I could write down the steps here - if it okay for you.

mv-debug avatar Nov 09 '20 10:11 mv-debug

How to:

  1. install docker and adb (https://docs.docker.com/get-docker/, https://developer.android.com/studio/command-line/adb)
  2. Run a container with e.g. docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-8.1
  3. Download Instagram (https://www.apkmirror.com/apk/instagram/instagram-instagram/instagram-instagram-139-0-0-33-121-release/instagram-139-0-0-33-121-12-android-apk-download/) app and install via adb install path_to_apk
  4. Log in manually and also search one time to access the permission pop up. These step have to be done manually and these have to be automated - if implemented the whole execution of the remote handling could be done in a cloud and in continuous deployment

I could also provide a video if you are interested.

mv-debug avatar Nov 09 '20 11:11 mv-debug

I just tried it and it looks like it is working but the emulator doesn't have Google Play Store... What did you use to download Instagram app? Also, do you have Discord? I am not sure if we should keep talking about this here as it not the main issue.

You could use adb to install an app. And you could download apps on some free platforms. Is it allowed to name it here, I will try: https://www.apkmirror.com/apk/instagram/instagram-instagram/instagram-instagram-139-0-0-33-121-release/instagram-139-0-0-33-121-12-android-apk-download/

It is important to use the x86 architecture - if you use docker on amd64 or x86 processor.

I do not have discord, sorry.

Cool, thanks! I will give it a try and let you know if it worked. I totally forgot I could add the apps via adb.

markbookk avatar Nov 09 '20 11:11 markbookk

@mv-debug thanks, What OS are you using to run it?

future2back avatar Nov 09 '20 14:11 future2back

@mv-debug thanks, What OS are you using to run it?

Hey, I use linux only for development - it is the better platform. But it should also work on windows. If you have got a problem with mac os or windows see: https://github.com/budtmo/docker-android#quick-start

mv-debug avatar Nov 09 '20 19:11 mv-debug

@mv-debug thanks for the help! I used adb install and it worked.

@future2back I also use Linux (Ubuntu) and I can also vouch that it works good.

markbookk avatar Nov 09 '20 19:11 markbookk

@mv-debug thanks for the help! I used adb install and it worked.

@future2back I also use Linux (Ubuntu) and I can also vouch that it works good.

I tested it also on a ubuntu machine with 16 cores, with that setup you can run multiple instances of the android simulation (I only test 4 at once). It works like a charm. But it will be nice to implement the login feature.

mv-debug avatar Nov 09 '20 19:11 mv-debug

@mv-debug Nice! Do you use cloud or local hosting?

markbookk avatar Nov 09 '20 20:11 markbookk

@mv-debug Nice! Do you use cloud or local hosting?

I tried in a cloud, but you have got manual steps for setup the environment. At the moment I have got a gitlab-runner on my local machine and let it run every hour. Works like charm.

mv-debug avatar Nov 10 '20 08:11 mv-debug

@mv-debug thanks, i will try it here on ubuntu and let you know

future2back avatar Nov 10 '20 10:11 future2back

I think I am going to write an script to setup the environment with uiautomator2.

mv-debug avatar Nov 10 '20 10:11 mv-debug

How to:

1. install docker and adb (**https://docs.docker.com/get-docker/**, **https://developer.android.com/studio/command-line/adb**)

2. Run a container with e.g.  **docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-8.1**

3. Download Instagram (**https://www.apkmirror.com/apk/instagram/instagram-instagram/instagram-instagram-139-0-0-33-121-release/instagram-139-0-0-33-121-12-android-apk-download/**) app and install via **adb install path_to_apk**

4. Log in manually and also search one time to access the permission pop up. These step have to be done manually and these have to be automated - if implemented the whole execution of the remote handling could be done in a cloud and in continuous deployment

I could also provide a video if you are interested.

Hello @mv-debug and @markbookk after installing docker (step 1) and added my user to docker group , followed step 2 , after acessing http://myip:6080 i can access it and see a page that has a whale Android Docker, could you describe the steps i should follow to make it works? I m new on Docker, i m sorry!

Thanks a lot.

future2back avatar Nov 10 '20 15:11 future2back

How to:

1. install docker and adb (**https://docs.docker.com/get-docker/**, **https://developer.android.com/studio/command-line/adb**)

2. Run a container with e.g.  **docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-8.1**

3. Download Instagram (**https://www.apkmirror.com/apk/instagram/instagram-instagram/instagram-instagram-139-0-0-33-121-release/instagram-139-0-0-33-121-12-android-apk-download/**) app and install via **adb install path_to_apk**

4. Log in manually and also search one time to access the permission pop up. These step have to be done manually and these have to be automated - if implemented the whole execution of the remote handling could be done in a cloud and in continuous deployment

I could also provide a video if you are interested.

Hello @mv-debug and @markbookk after installing docker (step 1) and added my user to docker group , followed step 2 , after acessing http://myip:6080 i can access it and see a page that has a whale Android Docker, could you describe the steps i should follow to make it works? I m new on Docker, i m sorry!

Thanks a lot.

Try in a console adb devices and check if you see something like this emulator-5554. If yes, you could install the downloaded app via adb install path_to_apk. The use the browser to log in. That's all.

mv-debug avatar Nov 11 '20 06:11 mv-debug

How to:

1. install docker and adb (**https://docs.docker.com/get-docker/**, **https://developer.android.com/studio/command-line/adb**)

2. Run a container with e.g.  **docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-8.1**

3. Download Instagram (**https://www.apkmirror.com/apk/instagram/instagram-instagram/instagram-instagram-139-0-0-33-121-release/instagram-139-0-0-33-121-12-android-apk-download/**) app and install via **adb install path_to_apk**

4. Log in manually and also search one time to access the permission pop up. These step have to be done manually and these have to be automated - if implemented the whole execution of the remote handling could be done in a cloud and in continuous deployment

I could also provide a video if you are interested.

Hello @mv-debug and @markbookk after installing docker (step 1) and added my user to docker group , followed step 2 , after acessing http://myip:6080 i can access it and see a page that has a whale Android Docker, could you describe the steps i should follow to make it works? I m new on Docker, i m sorry! Thanks a lot.

Try in a console adb devices and check if you see something like this emulator-5554. If yes, you could install the downloaded app via adb install path_to_apk. The use the browser to log in. That's all.

Hey @mv-debug thanks for replying, there is no emulator listed on my adb, i runned docker with the same line you listed on step 2! Is it ok?

Thanks

future2back avatar Nov 11 '20 14:11 future2back

@future2back are you using virtualization for the host OS of Docker?

markbookk avatar Nov 11 '20 14:11 markbookk

@future2back are you using virtualization for the host OS of Docker?

No, I m using ubuntu on a physical computer to run docker.... I tried rebooting my computer, after it

i had to remove --name android-container from this line:

docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-8.1

so i started docker image with this line:

docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" budtmo/docker-android-x86-8.1

is it ok? I m sorry, thanks for for taking your time.

future2back avatar Nov 11 '20 15:11 future2back

docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-8.1

I use this line and it works for me.

Why do you say you had to remove --name android-container? Any error occurred or anything pops up that you can share?

markbookk avatar Nov 11 '20 15:11 markbookk

docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-8.1

I use this line and it works for me.

Why do you say you had to remove --name android-container? Any error occurred or anything pops up that you can share?

heyy @markbookk i had no problem using this line at first time, as the emulator did not appear in the list of devices i restarted the computer, so, do i have to open it again? then if i try

docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-8.1

i get this error message:

docker: Error response from daemon: Conflict. The container name "/android-container" is already in use by container "e8c40ee99723e797c3e36b1cebc3fa330705de25bca47fff153b8a3032eacfd8". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.

thats why i removed --name android-container to "reopen" the image. So i could reopen it but still not appear in the list of devices when i use adb devices

future2back avatar Nov 11 '20 15:11 future2back

That error means that you already have a container running. You can do docker ps -a to list all containers (not just the ones that are running). More information here: https://docs.docker.com/engine/reference/commandline/ps/

You don't have to create a new docker container every time. You just need to start the container you already created with docker start {name} or in your case docker start android-container.

In regards to the device not showing on adb devices, I am not sure what the problem may be but it doesn't seem to be a problem with the "docker-android" as it works fine for me. I think your docker container isn't fully running, as you said you only see the "whale android docker" page and you are supposed to be seeing the android emulator.

markbookk avatar Nov 11 '20 17:11 markbookk

That error means that you already have a container running. You can do docker ps -a to list all containers (not just the ones that are running). More information here: https://docs.docker.com/engine/reference/commandline/ps/

You don't have to create a new docker container every time. You just need to start the container you already created with docker start {name} or in your case docker start android-container.

In regards to the device not showing on adb devices, I am not sure what the problem may be but it doesn't seem to be a problem with the "docker-android" as it works fine for me. I think your docker container isn't fully running, as you said you only see the "whale android docker" page and you are supposed to be seeing the android emulator.

@future2back Do you see an device under localhost:6080? Something like this. Screenshot_20201111-191718

If you Plug in an real device to the pc, do you see this one via adb? Maybe some udev rules cause problems. Try to use the original ubuntu package (sudo apt install adb), within this package the correct udev rules are rolled out..

mv-debug avatar Nov 11 '20 18:11 mv-debug

That error means that you already have a container running. You can do docker ps -a to list all containers (not just the ones that are running). More information here: https://docs.docker.com/engine/reference/commandline/ps/

You don't have to create a new docker container every time. You just need to start the container you already created with docker start {name} or in your case docker start android-container.

In regards to the device not showing on adb devices, I am not sure what the problem may be but it doesn't seem to be a problem with the "docker-android" as it works fine for me. I think your docker container isn't fully running, as you said you only see the "whale android docker" page and you are supposed to be seeing the android emulator.

Thanks for explain me that!

That error means that you already have a container running. You can do docker ps -a to list all containers (not just the ones that are running). More information here: https://docs.docker.com/engine/reference/commandline/ps/ You don't have to create a new docker container every time. You just need to start the container you already created with docker start {name} or in your case docker start android-container. In regards to the device not showing on adb devices, I am not sure what the problem may be but it doesn't seem to be a problem with the "docker-android" as it works fine for me. I think your docker container isn't fully running, as you said you only see the "whale android docker" page and you are supposed to be seeing the android emulator.

@future2back Do you see an device under localhost:6080? Something like this. Screenshot_20201111-191718

If you Plug in an real device to the pc, do you see this one via adb? Maybe some udev rules cause problems. Try to use the original ubuntu package (sudo apt install adb), within this package the correct udev rules are rolled out..

dock

There is no android phone like yours. Thats why i asked if the line on step 2 is correct.

If i right click on it: dock2

Yes i can see device to the pc on using adb.

Any idea? Thanks @markbookk

future2back avatar Nov 11 '20 18:11 future2back

That error means that you already have a container running. You can do docker ps -a to list all containers (not just the ones that are running). More information here: https://docs.docker.com/engine/reference/commandline/ps/ You don't have to create a new docker container every time. You just need to start the container you already created with docker start {name} or in your case docker start android-container. In regards to the device not showing on adb devices, I am not sure what the problem may be but it doesn't seem to be a problem with the "docker-android" as it works fine for me. I think your docker container isn't fully running, as you said you only see the "whale android docker" page and you are supposed to be seeing the android emulator.

Thanks for explain me that!

That error means that you already have a container running. You can do docker ps -a to list all containers (not just the ones that are running). More information here: https://docs.docker.com/engine/reference/commandline/ps/ You don't have to create a new docker container every time. You just need to start the container you already created with docker start {name} or in your case docker start android-container. In regards to the device not showing on adb devices, I am not sure what the problem may be but it doesn't seem to be a problem with the "docker-android" as it works fine for me. I think your docker container isn't fully running, as you said you only see the "whale android docker" page and you are supposed to be seeing the android emulator.

@future2back Do you see an device under localhost:6080? Something like this. Screenshot_20201111-191718 If you Plug in an real device to the pc, do you see this one via adb? Maybe some udev rules cause problems. Try to use the original ubuntu package (sudo apt install adb), within this package the correct udev rules are rolled out..

dock

There is no android phone like yours. Thats why i asked if the line on step 2 is correct.

If i right click on it: dock2

Yes i can see device to the pc on using adb.

Any idea? Thanks @markbookk

What kind of pc or laptop do you have? Sometime a start of an stopped container end in your situation. But a fresh container looks like my pic. Maybe some virtualization setting are not enabled or you do not have enough power for emulation.

mv-debug avatar Nov 11 '20 19:11 mv-debug