vivek shirodkar
vivek shirodkar

Reputation: 89

Android sdkmanager not found issue in ubuntu 22.04 based linux container

I am trying to install flutter on ubuntu 22.04 based linux container (on proxmox server).

sdkmanager --version

shows 7.0

flutter doctor 

shows message "Flutter requires Android SDK 29 and the Android BuildTools 28.0.3"

flutter doctor --android-licenses 

shows message that Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this.

sdkmanager --update

shows no updates available.

sdkmanager --list

shows Installed packages:=====================] 100% Computing updates...
Path | Version | Description | Location
------- | ------- | ------- | -------
build-tools;28.0.3 | 28.0.3 | PLACEHOLDER | build-tools/28.0.3
cmdline-tools;latest | 7.0 | Android SDK Command-line Tools (latest) | cmdline-tools/latest platform-tools | 33.0.2 | PLACEHOLDER | platform-tools

I found many solutions involving use of GUI on windows and Linux. Considering I have access to terminal and no GUI available, how do I resolve this issue

Snapshot of terminal

Upvotes: 1

Views: 902

Answers (1)

bitinerant
bitinerant

Reputation: 1571

The easiest solution is probably to enable graphical apps in your LXC container and run Android Studio inside LXC. The steps below will create a new LXC container with full X11 enabled (works with Wayland on the host too). Tested successfully on recent versions of Ubuntu (no audio support though).

1. Copy the following text into a new file /tmp/lxc_x11.profile:

config:
  environment.DISPLAY: :0
  environment.PULSE_SERVER: unix:/home/ubuntu/pulse-native
  #nvidia.driver.capabilities: all
  #nvidia.runtime: "true"
  user.user-data: |
    #cloud-config
    runcmd:
      - 'sed -i "s/; enable-shm = yes/enable-shm = no/g" /etc/pulse/client.conf'
    packages:
      - x11-apps
      - mesa-utils
      - pulseaudio
description: GUI LXD profile
devices:
  PASocket1:
    bind: container
    connect: unix:/run/user/1000/pulse/native
    listen: unix:/home/ubuntu/pulse-native
    security.gid: "1000"
    security.uid: "1000"
    uid: "1000"
    gid: "1000"
    mode: "0777"
    type: proxy
  X0:
    bind: container
    connect: unix:@/tmp/.X11-unix/X0
    listen: unix:@/tmp/.X11-unix/X0
    security.gid: "1000"
    security.uid: "1000"
    type: proxy
  mygpu:
    type: gpu
name: x11
used_by: []

2. Set up the new container:

VMNAME=name-of-new-container
lxc launch ubuntu:22.04 $VMNAME
lxc profile create x11 2>@1 |grep -v 'The profile already exists'  # needed once on host
cat /tmp/lxc_x11.profile |lxc profile edit x11  # needed once on host
lxc profile assign $VMNAME default,x11  # note--this changes sshd hostkey
lxc exec $VMNAME -- apt update
lxc exec $VMNAME -- sudo DEBIAN_FRONTEND=noninteractivee apt install -y x11-apps mesa-utils libxi6
lxc restart $VMNAME
lxc exec $VMNAME -- sudo --user ubuntu glxgears

Upvotes: 0

Related Questions