android-studio android-studio-dir location - flutter

I am trying to get flutter/android studios to work on linux and i am having an issue getting flutter to recognize my android-studio location.
I am able to run android-stuio, but when i try to tell flutter my install location via the android-studio-dir param i get something that doesn't work.
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.27.0-2.0.pre.78, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio
✗ android-studio-dir = ~/Downloads/android-studio/bin/
✗ Android Studio not found at ~/Downloads/android-studio/bin/
[✓] VS Code (version 1.53.1)
[!] Connected device
! No devices available
At location ~/Downloads/android-studio/bin/ i have the bin directory of my android studio install. This obviously doesn't work.
I have tried to look up what directory android-studio-dir needs to point at and it seems that i wants to point at a directory like /path/to/android/studio.
but in my install directory i dont have a studio directory to point at?
So my question is what should android-studio-dir point at?
I am able to run android studio by ./~/Downloads/android-studio/bin/studio.sh
So i am fairly confident i have android studio "installed" correctly.

For windows the commands are same like those from #Doc but take care of the slashes:
flutter config --android-sdk="C:/TestFolder/AndroidSDK"
flutter config --android-studio-dir="C:/Program Files/Android/Android Studio"

the commands are
flutter config --android-sdk="/home/user/Android/Sdk"
flutter config --android-studio-dir="/usr/local/android-studio"
Don't use the bin folder, just mark the root folder for both the sdk and the IDE. Also, use complete path.

A. To resolve your unrecognized sdk. issue, use following steps
Find your dir. location. You will find at same place
C:\users\UserName\AppData\Local\Android\SDK
Mine was at
C:\Users\SHARM\AppData\Local\Android\Sdk
Go to PowerShell and type
flutter config --android-sdk
"C:\users\UserName\AppData\Local\Android\SDK"
Change your Username above
PowerShell screenshot showing how I resolved unable to locate SDK issue
B. To resolve dir issue, type
flutter config --android-studio-dir "type directory name"
In my case, it was
flutter config --android-studio-dir "C:/Program Files/Android/Android Studio"
C. I have license issue so I am sharing here if in case you encounter it after fixing SDK and dir issue.
C.1 Open you Android Studio
C.2 On main screen, Click Advanced > SDK Manager
SDK Manager
C.3 Select SDK Tools
Check Android SDK Command-line tools and click ‘apply’.
Check Android SDK Command-line tools and click ‘apply’
C.4 Click Apply.
C.5 Your license issue will be resolved. You can test it by again going to PowerShell and type
flutter doctor
You will pass all tests like I did in photoflutter passed all tests
If you want to check your configurations for SDK, dir etc, just type flutter config and it will show you all configurations.

Related

Flutter doctor --android-licenses not finding sdkmanager without Android Studio

I'm trying to get my very first Flutter application up and running. When I ran flutter doctor it was saying that I was missing Android SDK, so I installed sdkmanager and ran:
sdkmanager "platform-tools" "platform;android-29" "build-tools;28.0.3"
From there I ran flutter config --android-sdk /opt/android-sdk
I got an error saying that I'm missing cmdline-tools, however I don't have Android Studio and don't want to as well. So I went on Android Studio's website and downloaded a manual cmdline-tools and moved the file to android-sdk. OK so far so good, right? No, now I needed to run flutter doctor --android-licenses and it's saying Android sdkmanager not found. Why? Is there something I'm missing? I'm doing all of this in Ubuntu.
Below is the image of flutter doctor status
Shows me running flutter doctor --android-licenses
As well as shows the path to the android-sdk in the terminal
I have as well set flutter config --android-sdk to the correct path
and is the reason why flutter doctor has no issues with finding the
android-sdk
Image!!
Android toolchain - develop for Android devices X cmdline-tools component is missing run path/to/sdkmanager --install "cmdline-tools;latest"
This error means your "Android SDK Command-line Tools are missing"
Open Android Studio
In the Menu bar , click Tools(4th last)
choose SDK Tools panel
Tick Android SDK Command-line Tools
Click Apply at bottom of the window
I gave up and just downloaded android studio using snap package manager and within android studio I did the steps discussed above.
After downloading cmdline-tools from android studio. I have just set the android config --android-sudio-dir "toMyAndroidStudioPath" example. /home/myName/Android/Sdk....

Flutter 2.5 cannot recognise sdkmmnager, although everything was fine before upgrading

So yesterday i upgraded flutter to 2.5 and flutter doctor said android-licenses status unknown. So, I ran flutter doctor --android-licenses and it says that sdkmanager not found although the previous version which was probably 2.2.3 didn't say anything like that. I did not install cmdline-tools the "android studio" way. I followed a guide and downloaded the android cmdline-tools.zip file, unpacked it inside "android" folder, made a new tools folder (inside android folder) and copied everything from the android folder to the tools folder. Then I set path to sdkmanager, platform-tools and emulator.
After that I installed platform-tools 31.0.0, android-sdk 31.0.0 and an emulator. At that time flutter was able to recognise sdkmanager and it gave no errors. How do i solve this? Did something related to where the sdkmanager should be located change?
The output of flutter doctor:
[✓] Flutter (Channel stable, 2.5.0, on Arch Linux 5.13.13-zen1-1-zen, locale
en_IN.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
✗ 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.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] Connected device (1 available)
and the output of flutter doctor --android-licenses:
cmdline-tools are installed to resolve this.
Also i can run the default app just fine.
I am running linux.
For Windows, you can use this command:
flutter config --android-studio-dir="Path to your Android Studio"
Double check that inside Android Studio > SDK Manager > SDK Tools, Android SDK Command-line Tools are installed.

Android Studio Dart And Flutter Plugin is not installed

Here is the flutter doctor result:
[√] Flutter (Channel stable, 1.22.1, on Microsoft Windows [Version 10.0.18362.30], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
I have already installed the flutter plugin. But the problem still exists. How can I fix this?
Just run this on your terminal (Mac users)
ln -s ~/Library/Application\ Support/Google/AndroidStudio4.1/plugins ~/Library/Application\ Support/AndroidStudio4.1
Well hello all
I would suggest you all to follow the steps what flutter documentation sites tells you to do
For windows-->There are some people who got detected flutter and dart plugins by the flutter doctor and few are not
I got this issue when I tried to install ...
I did everything like installed flutter and dart plugin still my flutter doctor haven't detected the plugins ...
following steps worked for me
flutter channel dev
flutter upgrade
flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"
flutter doctor -v
note :--- flutter config --android-studio-dir="C:\Program Files\Android\Android Studio" should be example flutter config "C:\Program Files\Android\Android Studio"
above steps worked for me i hope it will helps you too :)
change channel master to dev.
then upgrade.
flutter channel dev
flutter channel upgrade
try again
flutter doctor
Note: I think it's Android Studio 4.1 issue...
Since you say you have flutter plugin installed in Android Studio, and if Android Studio correctly shows your installed plugin, there is no reason to believe any third-party tool reporting otherwise.
Also, this will not affect your flutter development and your IDE plugins will work as expected inside the IDE and flutter tool's commands work independent of the IDE in use.
Android Studio 4.1 apparently changed its default plugin install path.
Related github issue: [flutter_tools] IDE plugin validators should be deprecated #61246
Flutter does not directly use the IDE plugins, so doctor failing to detect them does not affect any behavior (it's just annoying).
open terminal:
run> flutter channel dev
run> flutter channel updrade
open terminal:
Mac User:
flutter config --android-studio-dir=/Applications/Android\ Studio.app
Reinstall Flutter Plugin from Android Studio
Are you using Android Studio V 4.1?
With Android Studio V4.1 there is a problem.
Try to reinstall Android Studio but Version 4.0.1 and try it again, chances are this will fix your problem.
Open Android studio
Follow the Path Configure > Plugins > marketplace > search Flutter & Dart > Install
Restart IDE(Android studio)
Open Terminal and Export Flutter Path
and run flutter doctor -v
If you are upgrading for an existing project:
Run
git clone https://github.com/flutter/flutter.git
in your terminal.
The be sure to delete the Flutter folder in your App's root directory. Otherwise you will get over 50k errors popping up
Check your flutter PATH
which flutter
if you get /path-to-flutter-sdk/bin//flutter or similar you may have added an extra / in your $HOME/.rc_file. Remove the last '/', restart terminal and try again
this worked for me
flutter channel dev
flutter doctor

flutter run -bash: Desktop/flutter/bin/flutter: No such file or directory

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.14.6 18G103, locale pl-PL)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
If the Android SDK has been installed to a custom location, set
ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[!] Android Studio (not installed)
[!] Connected device
! No devices available
I created a my_app folder and typed:
cd my_app
flutter run
The "flutter run" command does not work. How to fix this?
Have you installed android sdk?
If not then installing Android Studio will will install all the required dependencies.
I faced this problem it easy to solve
Open Android Studio
And go to preference
Plugins
Download flutter & dart
You need Android SDK, if you plan on using Android Studio then SDK will be downloaded with the Android Studio
https://developer.android.com/studio is the link to download

`flutter doctor` report error `Android toolchain - develop for Android devices`

I run flutter doctor in my Mac:
there comes an issue below:
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14 18A391, locale
zh-Hans-CN)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.dev/setup/#android-setup for detailed
instructions).
If the Android SDK has been installed to a custom location, set
ANDROID_HOME to that location.
You may also want to add it to your PATH environment variable.
But I have installed Android SDK in my Mac this path /Users/delo/software/android-sdk-macosx.
before ask this question I have follow this post to add the /Users/delo/software/android-sdk-macosx in my /etc/paths.d/android-sdk file, and this post add path-to-android-sdk/tools and path-to-android-sdk/platform-tools.
but there is still have this issue.
EDIT-01
This is the echo $PATH:
/Library/Frameworks/Python.framework/Versions/3.5/bin:/Users/delo/.rvm/gems/ruby-2.3.3/bin:/Users/delo/.rvm/gems/ruby-2.3.3#global/bin:/Users/delo/.rvm/rubies/ruby-2.3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Users/delo/software/android-sdk-macosx:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/opt/local/bin:/usr/local/mysql/bin:/usr/local/Cellar/go/1.7.6/bin:/Users/delo/.rvm/bin:/usr/local/sbin:/Users/delo/software/android-sdk-macosx/tools:/Users/delo/software/android-sdk-macosx/platform-tools
I see your $PATH have add the ANDROID SDK PATH and its tools and platform-tools PATH, but did not config the flutter PATH, but you can still run flutter doctor command, there should be copy error.
in your case, there must be ANDROID_HOME variable config error,
you should follow the correct way :
append the
export PATH=/path/to/your/flutter/bin:$PATH
export ANDROID_HOME="/path/to/your/android-sdk"
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
to
then you just source ~/.bash_profile.
I believe the problem is in the PATH of Android SDK Command-Line Tools and Android SDK Build Tools.
Put the lines at the end of the .bachrc file:
export ANDROID_HOME="/home/XXX/Android/Sdk/"
export PATH="$PATH:${ANDROID_HOME}cmdline-tools/latest/bin/:${ANDROID_HOME}build-tools/33.0.0/:${ANDROID_HOME}platform-tools/"
Note that latest and 33.0.0 must be changed according to your installation.