`KeyError: ('cmdline-tools','latest')` on `sdkmanager --install "cmdline-tools;latest"`

Bug #2046052 reported by Benjamin LOISON
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sdkmanager (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

```
$ sdkmanager --install "cmdline-tools;latest"
Traceback (most recent call last):
  File "/usr/bin/sdkmanager", line 33, in <module>
    sys.exit(load_entry_point('sdkmanager==0.5.1', 'console_scripts', 'sdkmanager')())
  File "/usr/lib/python3/dist-packages/sdkmanager.py", line 1077, in main
    method(args.packages)
  File "/usr/lib/python3/dist-packages/sdkmanager.py", line 891, in install
    url = packages[key]
KeyError: ('cmdline-tools', 'latest')
```

The reason why I tried running above command is that when [installing `flutter`](https://docs.flutter.dev/get-started/install/linux#verify-your-install-with-flutter-doctor) we are invited to run `flutter doctor` which in my case returned:

```
...
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.
...
```

Using `sdkmanager` from [this source](https://developer.android.com/studio#command-line-tools-only) works fine.

Already noticed on Stack Overflow:
- https://stackoverflow.com/q/76497510
- https://stackoverflow.com/q/76198068

```
$ lsb_release -rd
Description: Ubuntu 22.04.3 LTS
Release: 22.04
```

```
$ apt-cache policy sdkmanager
sdkmanager:
  Installed: 0.5.1-1
  Candidate: 0.5.1-1
  Version table:
 *** 0.5.1-1 500
        500 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy/universe arm64 Packages
        100 /var/lib/dpkg/status
```

Revision history for this message
Hans-Christoph Steiner (eighthave) wrote :

This works for me in v0.6.4:

 ~ $ sdkmanager --install "cmdline-tools;latest"
Downloading https://dl.google.com/android/repository/commandlinetools-linux-11391160_latest.zip into /home/hans/.cache/sdkmanager/commandlinetools-linux-11391160_latest.zip
Unzipping to /tmp/.sdkmanager-olwn0xvm
Installing into /tmp/android-sdk/cmdline-tools/latest
 ~ $

You can get recent versions from the PPA:
https://launchpad.net/~fdroid/+archive/ubuntu/fdroidserver

Changed in sdkmanager (Ubuntu):
status: New → Confirmed
Revision history for this message
Benjamin LOISON (benjamin.loison) wrote :

Thank you for you feedback this issue can now be closed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.