Missing documentation tip on constraints for installation of Android Studio for "flutter doctor" to identify its version

Aperta
#12,348 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
50/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
android, linux
Ambito
documentation

Direzione di ricerca

Inizia da src/content/get-started/install/linux/android.md e dalla sezione Configure the Android toolchain in Android Studio. Esamina le istruzioni per l’installazione e la sezione collegata Check your development setup, quindi documenta i vincoli indicati per /opt/android-studio e $HOME e i comandi prerequisiti; il lavoro è completo quando la nota spiega accuratamente come flutter doctor identifica la versione di Android Studio.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

e2-days from.page-issue p2-medium
Page URL

https://docs.flutter.dev/get-started/install/linux/android/

Page source

https://github.com/flutter/website/tree/main/src/content/get-started/install/linux/android.md

Describe the problem

The Android Studio documentation suggests that it can be installed anywhere one likes on Linux. And in practice it might be the case. But i've just spent long hours trying to figure out why "flutter doctor" could not identify the version of my installation of android-studio.

I refused to install a tool in the user account where i do my development. It turns out that the only other place that "flutter doctor" will find android-studio is under /opt/android-studio. But that is not enough. It won't identify its version if there is an additional level of hierarchy under that. So for instance, do not install it under /opt/android-studio/2025.1.1 or /opt/android-studio/current.

Also i wanted "flutter doctor" to work out of the box, without a prior execution of android-studio, because it should be independent of the sequence in which the tools are run by me or any other user on the Linux station. It turns out that i had to run 2 additional commands before "flutter doctor" would finally identify the version number of Android Studio.

flutter config --android-studio-dir=/opt/android-studio

echo "/opt/android-studio" | tr -d '\n' > ~/.cache/Google/$(cat /opt/android-studio/product-info.json | jq -r '.dataDirectoryName')/.home

I'm assuming that "flutter doctor" would not flag the version identification as an issue if it weren't important.

The 2nd command would not be required if it were performed by flutter config.

The constraints on /opt/android-studio could be slackened if an env var were introduced for ANDROID_STUDIO_ROOT or, as on MacOS, the flutter doctor checked the contents of prduct-info.json.

A new user cannot be expected to guess or reverse engineer this.

Expected fix

Add a tip under https://docs.flutter.dev/get-started/install/linux/android#configure-the-android-toolchain-in-android-studio

On Linux, for "flutter doctor" (see https://docs.flutter.dev/get-started/install/linux/android#check-your-development-setup) to identify the installed version of Android Studio, it must either be installed in /opt/android-studio or in your $HOME. If it is installed in /opt/android-studio, it must not have an additional hierarchy level such as /opt/android-studio/2025.1.1 or /opt/android-studio/current.

Until "flutter doctor" is fixed, you have to run these two commands before running "flutter doctor":

flutter config --android-studio-dir=/opt/android-studio

echo "/opt/android-studio" | tr -d '\n' > ~/.cache/Google/$(cat /opt/android-studio/product-info.json | jq -r '.dataDirectoryName')/.home

Additional context

No response

I would like to fix this problem.
  • I will try and fix this problem on docs.flutter.dev.
Lingua principale
Dart
Stelle
3.1k
Fork
3.5k
Merge medio
2g 10h
PR unite (30g)
88

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di flutter/website

Tutte le issue di flutter/website

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.