Giter Site home page Giter Site logo

Comments (9)

thyrlian avatar thyrlian commented on May 20, 2024 1

For my integrated graphics card, I also tend to leave my laptop running/hibernating for weeks, but I haven't run into any problem launching emulator inside a container.

I got your purpose now, and I don't think emulator in container is a good solution for you. Please go and give a try of the x86 emulator from Android Studio, that should serve your needs.

from androidsdk.

thyrlian avatar thyrlian commented on May 20, 2024

Hi @aerymilts, I'm currently in the hospital and will check this once I'm back home.

In general, I've tested the container on my side before publishing it, I can view the emulator, interact with the emulator via mouse, and also run UI test on the emulator.

BTW, the warning you've got is not a big deal, you can totally ignore that.

Another matter is, virtualizing an ARM-based emulator, inside a docker container is a quite expensive action, for sure it will be slow. It may take even a few minutes before the real Android screen gets rendered properly.

I'll try to reproduce using the steps you've provided, and share the updates here.

from androidsdk.

aerymilts avatar aerymilts commented on May 20, 2024

Hey @thyrlian, I'm sorry to hear that you're in hospital. I hope you get well soon.

I've tried leaving the emulator to start and render for up to half an hour at a time but nothing shows up.

Not sure if this bit of information helps, but I have also tried installing packages from the container and that didn't work. I'm wondering if this is a sign that the emulator hasn't booted properly.

root@20448ea13e96:$ adb install com.amazon.kindle.apk
Performing Streamed Install
adb: failed to install com.amazon.kindle.apk: Can't find service: package

As a thought, would running dind (Docker in Docker) allow for virtualizing an x86-based emulator instead? I intend to use the emulator to use apps that have better support on mobile vs desktop.

I didn't say this the first time round, but fantastic job on this repository and the support you're providing. I saw the level of details you were providing (and spelling out, in some cases) in the other resolved issues. 👍

from androidsdk.

thyrlian avatar thyrlian commented on May 20, 2024

Thank you @aerymilts for your acknowledgement and good wishes. I'm getting better now so I've played a bit.

By following the same steps you've listed, I'm able to launch the emulator and interact with it as well.

And I've tried both of the rendering options below, none of them has a problem.

emulator -avd 24_test -no-audio -no-boot-anim -gpu off &
emulator -avd 24_test -no-audio -no-boot-anim -accel on -gpu swiftshader_indirect &

As I said before, the virtualization inside Docker container is quite expensive, the bootup (readiness) of the emulator may take some minutes, which varies between machines (for instance: MacMini is way faster than MacbookPro). In fact, on my MacbookPro I haven't been waiting too long. And the other error message you've given - Can't find service: package tells that the bootup process is not finished yet (or properly). My suggestion would be: try with a powerful machine or some cloud service. Please forget about Docker in Docker, it won't help.

VNC 1

VNC 2

from androidsdk.

aerymilts avatar aerymilts commented on May 20, 2024

Hey @thyrlian, appreciate you testing out my scripts on your setup. Good to know I've set it up correctly and it's just down to the hardware. It appears that my GPU is not shared with the container. I managed to get the emulator going by disabling automatic graphics switching. The interface is incredibly slow, as you've pointed out before.

Re: dind, I just went over the Emulator section again. Does this mean that there's absolutely no way for a Mac user to run x86 emulators (short of dual booting into Linux)? I did find that there are paid options out there that enabled nested virtualization but it seems like there's not much support for this.

I don't have any knowledge in this area - do you have any recommendations/thoughts?

from androidsdk.

thyrlian avatar thyrlian commented on May 20, 2024

Hi @aerymilts, it's really good to hear that now it works for you after your magic tweak on your host machine. I'd like to copy the screenshot here from the link you've given, for other users' reference, because Apple moves its "permalink" often. Actually this is something new to me since my MacbookPro only has an integrated graphic card, I don't even have such option (meaning the performance on my machine should be worse than yours, still I'm able to run UI test under acceptable timing).

yosemite-system-prefs-energy-saver-automatic-graphics-switching-disable

Regarding dind:

  • In general, it's not possible on macOS. However, it's not absolutely impossible, if you can manage to port KVM to macOS, plus a ton of hacks, it may work, probably that doesn't worth the effort.
  • Yes, not long ago VirtualBox started to support nested virtualization, gradually from AMD CPU to Intel CPU.
  • Ultimately, I would pay more attention to the intention rather than the solution. We could get it working in some way, but in the end, the performance won't make us satisfied. For the sake of debugging, or just playing around, the simplest solution would be the Intel x86 emulator which comes with Android Studio. The emulator inside a Docker container is designed for CI purpose, for UI test automation. And usually, the companies have powerful Linux machine on-premises, or pay some cloud computing services, there the support for x86 emulator inside Docker container is optimal. What do you think?

from androidsdk.

aerymilts avatar aerymilts commented on May 20, 2024

@thyrlian, go for it. I hope this is helpful for someone else in the future as well. 😄 That's interesting. I think the reason why it doesn't work on my integrated graphics is because I have a bad habit of leaving my laptop on for weeks at a time, so there's usually resource leaks which doesn't work very well for high performing apps. For reference, here are the stats of my MBP
image

  • In general, it's not possible on macOS. However, it's not absolutely impossible, if you can manage to port KVM to macOS, plus a ton of hacks, it may work, probably that doesn't worth the effort.
  • Yes, not long ago VirtualBox started to support nested virtualization, gradually from AMD CPU to Intel CPU.

Thanks for sharing, that's where I ended up as I went down the rabbit hole. I'm pretty much stuck as virtualization and architectures is way out of depth for me.

  • Ultimately, I would pay more attention to the intention rather than the solution. We could get it working in some way, but in the end, the performance won't make us satisfied. For the sake of debugging, or just playing around, the simplest solution would be the Intel x86 emulator which comes with Android Studio. The emulator inside a Docker container is designed for CI purpose, for UI test automation. And usually, the companies have powerful Linux machine on-premises, or pay some cloud computing services, there the support for x86 emulator inside Docker container is optimal. What do you think?

My intent is to build an emulator that allows me to use mobile apps that requires low to moderate resources (think: smooth paging for Kindle for Android on an emulator), using open source tools, high reproducibility (container as code) and is easy to port across OSes. That's how I got to Docker and your project.

I also came across BlueStacks which serves my purpose pretty well (in fact it seems like it's meant for high performance mobile gaming). It's just that it's not open source and it doesn't have high configurability. I initially thought that I'd just have to go deeper into Docker to find the right setup to get it to work just like how BlueStacks does it. But it seems like there are limitations with Docker that just doesn't allow it. Is my understanding accurate?

from androidsdk.

aerymilts avatar aerymilts commented on May 20, 2024

For the sake of debugging, or just playing around, the simplest solution would be the Intel x86 emulator which comes with Android Studio.

I just realised, did you mean to say that using the x86 emulator with Android Studio natively on my MBP would work?

edit: From the Emulation section:

You can't run software that uses another virtualization technology at the same time that you run the accelerated emulator. For example, VirtualBox, VMWare, and Docker currently use a different virtualization technology, so you can't run them at the same time as the accelerated emulator.

Just realised that this means I would be able to use an x86 emulator only if Docker isn't running.

from androidsdk.

aerymilts avatar aerymilts commented on May 20, 2024

Sorry for the late response. Yes, it seems that accelerated containerised emulation for Mac is a convoluted solution at best. Thank you for helping me with this!

from androidsdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.