Android Development inside a container with GUI!

Table of Contents

Creating a contained environment for Android Developmemt

Requirements:

Get the Image

$ podman pull docker.io/fedora

Preparing the image:

  1. Setting the between container and host machine:

    a. For Container to run GUI apps in host machine

    host => /tmp/.X11-unix ----to---- container => /tmp/.X11-unix
    

    b. For files

    host => /home/username/Desktop/dirname ------to----- container => /home/
    

    c. For KVM issue

    host => /dev/kvm ------to----- container => /dev/kvm
    
  2. Setting the environment variable:

    DISPLAY = :1
    

Run the container and install some GUI apps like Librewolf

It will work!!

The path you configured for files use it to put android-studio setup file inside container

Install dependancies for Android Studio

sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:

Error

E: Unable to locate package libc6:i386
E: Unable to locate package libncurses5:i386
E: Unable to locate package libstdc++6:i386
E: Couldn't find any package by regex 'libstdc++6'
E: Unable to locate package libbz2-1.0:i386
E: Couldn't find any package by glob 'libbz2-1.0'
E: Couldn't find any package by regex 'libbz2-1.0'

Solution

First verify the architectures configured in your system;

sudo dpkg --print-architecture         //amd64

Second look for any other foreign architectures

sudo dpkg --print-foreign-architectures      //response should be nothing

Now proceed to add 32-bit architecture

sudo dpkg --add-architecture i386

Verify 32-bit is added

sudo dpkg --print-foreign-architectures      //i386

Then update your packages

sudo apt-get update

Now you can install your 32-bit packages

sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:

Extract Android studio setup to “/opt”

tar -xf android-studio-2022.2.1.20-linux.tar.gz -C /opt
$ ./studio.sh

Error

Error while waiting for device: /dev/kvm is not found.

Enable VT-x in your BIOS security settings, ensure that your Linux distro has working KVM module.

Solution while adding the paths add

 host => /dev/kvm ------to----- container => /dev/kvm:
Tags :