gitpod icon indicating copy to clipboard operation
gitpod copied to clipboard

[recovered issue #723]: Support Android app development

Open jankeromnes opened this issue 5 years ago • 23 comments

It seems that GitHub accidentally took down issue #723, but they kindly provided the missing content so that we could re-post it.


@dongfangxunlei at 2019-08-13T06:55:40Z:

android SDK/NDK is so large. Is there existing image containing it? android studio is better.

@svenefftinge at 2019-08-13T12:07:40Z:

We would have that, but ATM Gitpod doesn't support running emulators in the container.

@JesterOrNot at 2019-10-05T15:21:45Z:

I'll try and see if I can get something together

@JesterOrNot at 2019-10-05T15:28:27Z:

Here is the repo in case you're interested https://github.com/JesterOrNot/Gitpod-Android

@jankeromnes at 2019-10-08T08:51:36Z:

@JesterOrNot Exciting! Thanks a lot for setting up this repository. Have you tried to build an Android app with it?

@JesterOrNot at 2019-10-08T13:01:46Z:

I am trying but I need help most good vscode extensions for android development require the installation of android studio and I can't figure out how to do that EDIT: I finished installing it take a look!

@JesterOrNot at 2019-10-08T20:24:12Z:

For testing, I think a good starting place is https://github.com/jesterornot/termux-app

@JesterOrNot at 2019-10-08T22:10:19Z:

it works!!!!!!!!!!!!!!! image image image

@JesterOrNot at 2019-10-08T22:27:45Z:

now all that's left is finding a way to automate the setup of android studio! does anyone have any ideas?

@jankeromnes at 2019-10-10T13:05:10Z:

@JesterOrNot Wow, that's amazing! Thanks a lot for getting it to work. 💯

Regarding automating the setup of Android Studio, I don't think they have a non-interactive setup (e.g. via a command line interface) so I think our best bet is to find where Android stores its configuration files, and then import or generate them programmatically in your Dockerfile.

For example, you could set up Android Studio manually, and then inspect what changes that did to the file system. Android Studio probably has a configuration directory that you can look into.

(Or, worst case, we could also run the Docker image locally, set up Android Studio, and then use Docker to inspect the file system layer changes with docker diff.)

@JesterOrNot at 2019-10-11T01:14:10Z:

Great idea! I'll get to it!

@JesterOrNot at 2019-11-16T17:13:00Z:

@jankeromnes upon further testing when I tried to start an android project this happened image

@jankeromnes at 2019-11-18T10:57:27Z:

@JesterOrNot Amazing progress! Thanks a lot for blazing the trail here. 💯

From the error message, it seems that we can't install an x86-64 AVD, because it requires hardware acceleration (VT-X or SVM). After a quick research, it seems we can't enable that in Docker containers.

So I think our options here are:

  1. Use a physical device for testing

I.e. develop your app in Gitpod, and test by flashing a real Android device connected to your laptop, either by:

  • downloading a flashable image from Gitpod (with flashing tools included), or
  • using something like https://github.com/inlets/inlets to connect Gitpod with your local Android device (but I'm not even sure whether this can work, given that inlets is for networks while Android flashing probably requires USB interaction)

or

  1. Use an Android Virtual Device based on an ARM system image

If I understand this correctly, I think using an ARM-based AVD here will come with its own emulated ARM CPU. This means the emulated CPU can have all the required features, however it will be super slow (because 100% of the hardware will be emulated in software).

@JesterOrNot at 2019-11-19T02:56:56Z:

So @jankeromnes, what are our next steps?

jankeromnes avatar Feb 26 '20 18:02 jankeromnes

@jankeromnes Can you make TLDR from this? It's unnecessarily long.

Kreyren avatar Feb 27 '20 00:02 Kreyren

image

Seems to be relevant to https://github.com/gitpod-io/gitpod/issues/1265

Kreyren avatar Feb 27 '20 00:02 Kreyren

@Kreyren Basically Issue reporter: I want to develop android! Sven: Not possible Me: I'll take a stab take a look at https://github.com/JesterOrNot/Gitpod-Android Me: I did it (sends a lot of screenshots with Android Studio installed) Jan: Great job Sean Me: Oh I need KVM Jan: Hmm we could A: Use physical device via inlets, B: downloading a flashable image from Gitpod (with flashing tools included) C: Use An ARM-based Virtual device (it will be really slow)

JesterOrNot avatar Feb 27 '20 00:02 JesterOrNot

@JesterOrNot thank you! ^-^

i think i understand the issue, but i don't know why is solution proposed in https://github.com/gitpod-io/gitpod/issues/1265#issuecomment-591711957 not an option?

Kreyren avatar Feb 27 '20 03:02 Kreyren

Neither do I, Does it work?

JesterOrNot avatar Feb 27 '20 03:02 JesterOrNot

@geropl if you have time can you take a look?

JesterOrNot avatar Feb 27 '20 04:02 JesterOrNot

@JesterOrNot i believe that referenced sourcehut is a proof of it working well.

Kreyren avatar Feb 27 '20 04:02 Kreyren

I know but what about in gitpod

JesterOrNot avatar Feb 27 '20 04:02 JesterOrNot

@JesterOrNot looks like same usecase to me just different product provided

Kreyren avatar Feb 27 '20 04:02 Kreyren

No, I mean do we have KVM/QUEMU running in a workspace?

JesterOrNot avatar Feb 27 '20 04:02 JesterOrNot

@JesterOrNot Based on available info we don't since that would require sharing /dev/kvm to dockerd thus proposed to replace docker with vagrant which is based on available info more secure, more efficient on system resources and does not have these limitations and is compatible with current dockerfile configurations.

hardware used on gitpod based on the data that i was able to harvest from it supports KVM (root access is required to confirm).

Kreyren avatar Feb 27 '20 04:02 Kreyren

@geropl if you have time can you take a look?

@JesterOrNot Thanks a ton for your investigation. The runtime change required to be able to (potentially) open up KVM is on our radar but not within short reach. It's more several months than weeks and we're not ready to commit to a timeline for it, yet.

@Kreyren Thank you for the suggestions. We're observing the space for some time now and indeed are favouring options that would make Gitpod feel more like a VM than a container.

geropl avatar Feb 27 '20 13:02 geropl

@geropl The runtime change required to be able to (potentially) open up KVM is on our radar but not within short reach. It's more several months than weeks and we're not ready to commit to a timeline for it, yet.

Why that long? I see this being deployed under 12 hours with hardening.

Would be willing to provide the userland and kernel assuming hardware info and abstract provided.

Kreyren avatar Feb 27 '20 14:02 Kreyren

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 04 '20 12:10 stale[bot]

Keep this alive

ceefour avatar Oct 04 '20 14:10 ceefour

@geropl Several months have passed, do you have an update on the current status? Is there anything missing you need from the underlying infrastructure?

ffeldhaus avatar Oct 16 '20 21:10 ffeldhaus

I've created a way to connect an Android device to ADB running in gitpod using a websocket https://github.com/parched/remote-web-adb I've tried adb shell and it worked alright. Pushing and pulling is a bit slow, but that may be my crappy internet connection.

parched avatar Feb 11 '21 11:02 parched

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 16 '21 21:03 stale[bot]

So anything yet :sweat_smile: ?

axonasif avatar Jun 02 '21 01:06 axonasif

I found a neat way to do real Android development with Gitpod. I have created a template with a guide here.

JamesCullum avatar Nov 18 '21 13:11 JamesCullum

@JamesCullum but you still need to access outside the Gitpod IDE to run tunneling software like ngrok in your example. Is there a way to not touch other resources outside the Gitpod?

vukkumsp avatar Jan 27 '22 13:01 vukkumsp

To run the emulator, you need different VMs / hardware that Gitpod doesn't have. So you cannot run the emulator within Gitpod, if that's what youre asking. Of course you can run the tunnel in a different way (eg port opening, on the phone itself) to not have the setup on a desktop machine.

JamesCullum avatar Jan 27 '22 13:01 JamesCullum

I am not sure if this is a viable option but theoretically it should work.

launch a vpn for that specific container where users can connect their mobile phones to and debug wirelessly.

YazeedAlKhalaf avatar Apr 08 '22 11:04 YazeedAlKhalaf