Flutter and Dart Plugins Android Studios - dart

[✗] Android toolchain - develop for Android devices
✗ ANDROID_HOME = User/grantrienstra/Library/Android/sdk
but Android SDK not found at this location.
Is what I've been getting when I run flutter doctor -v and Youtube has not yielded any answers. Do you know how to install the Android toolchain? I have Android Studios downloaded and the Flutter and Dart plugins integrated.

By checking your path I'm assuming you're on Mac so try to add the tools and platform-tools to your PATH environment variable by running the following on the terminal:
export PATH=$PATH:~/Library/Android/sdk/tools
export PATH=$PATH:~/Library/Android/sdk/platform-tools
Then you should be good to go.

Related

Downloaded executables cannot execute on host - MacOS Monterey 12.4, Silicon Chip

I was recently trying to run my flutter app. However, when I tried to do so, I got the following error:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=3):
Application launch for 'com.[redacted]' did not return a valid pid
nor a launch error.
No such process
Command: /usr/bin/arch -arm64e xcrun simctl launch AA375D1F-5CFC-4D1B-B367-
4CB98488D7DA
com.[redacted] --enable-dart-profiling
--enable-checked-mode --verify-entry-points --observatory-port=0
Error launching application on iPhone 13.
To try and fix this, I ran flutter doctor, where I got the following errors:
See https://github.com/flutter/flutter/issues/6207 for more information
[✗] 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, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Community Edition (version 2022.1.2)
[✓] VS Code (version 1.67.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
I have already tried uninstalling and reinstalling flutter, and I am still getting the same error. I am genuinely confused as to why this happening, and I would really appreciate some help. Thank you in advance!
After running this command: $ sudo softwareupdate --install-rosetta --agree-to-license,
the problem appears to have been fixed. I ran flutter doctor, and this was the output:
[✗] 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, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Community Edition (version 2022.1.2)
[✓] VS Code (version 1.67.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
(Ignore the android issues- I intentionally did not install them).
I was getting the same error on my mac M1.
looks like,rosetta was not installed properly.
Install rosetta using.
sudo softwareupdate --install-rosetta --agree-to-license

Why my Flutter app not running on iPhone?

I successfully run my app on simulator(iPhone 12, iOS 14.5), but when it running on real iPhone 11 Pro Max(iOS 14.7.1) I facing just a black screen. Here is the output from Xcode:
2021-09-16 18:48:00.155232+0300 Runner[2396:1009680] Metal API Validation Enabled
2021-09-16 18:48:00.244991+0300 Runner[2396:1009680] Could not load the "LaunchImage" image referenced from a nib in the bundle with identifier "xxx.yyy.zzz"
2021-09-16 18:48:00.353909+0300 Runner[2396:1009946] [VERBOSE-2:shell.cc(93)] Dart Error: Can't load Kernel binary: Invalid kernel binary format version.
2021-09-16 18:48:00.354015+0300 Runner[2396:1009946] [VERBOSE-2:dart_isolate.cc(170)] Could not prepare isolate.
2021-09-16 18:48:00.354185+0300 Runner[2396:1009946] [VERBOSE-2:runtime_controller.cc(382)] Could not create root isolate.
2021-09-16 18:48:00.354213+0300 Runner[2396:1009946] [VERBOSE-2:shell.cc(576)] Could not launch engine with configuration.
2021-09-16 18:48:00.367242+0300 Runner[2396:1009960] flutter: Observatory listening on http://127.0.0.1:54273/PrvtvZOQ8Wc=/
Flutter doctor:
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-x64, locale
ru-BY)
[✗] 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, please use
flutter config --android-sdk to update to that location.
[✓] Xcode - develop for iOS and macOS
[✗] Chrome - develop for the web (Cannot find Chrome executable at
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] Connected device (2 available)
Xcode 12.5.1
UPDATED
To fix this, remove run rm -rf ~/flutter/bin/cache. Then run flutter run (you should run your app from terminal instead of IDE in order to Flutter download missing files). It's somehow works now.
Deleting the cache using rm -rf ~/flutter/bin/cache worked for me. This issue seems to have been caused by a bad Flutter installation. Running flutter pub get after deleting the cache should download the packages again and rebuild the project.

Flutter run xcode build fails but building directly with xcode succeeded

I'm new to iOS development and I ran into this problem at the very beginning:
When I tried to flutter run my hello world app I got xcodebuild failed (I took only the last lines since it's too long):
81 errors generated.
<unknown>:0: error: failed to emit precompiled header '/Users/mehec/Library/Developer/Xcode/DerivedData/Runner-cssmbpuzzkyjvpfghedbpvdhbbmr/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_2PXLF604USZTM-clang_KLU4EDN5EN1U.pch' for bridging header '/Users/mehec/Desktop/bgp/learn_flutter_0_test/ios/Runner/Runner-Bridging-Header.h'
<unknown>:0: error: generate-pch command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Planning build
note: Constructing build description
I then tried to build and run in xcode and everything's fine.
I have tried flutter clean and flutter upgrade even creating a new project but no effect
I'm using macOS 10.14.6, IntelliJ Idea 2020.1, Flutter 1.17.5 and 1.19.0, Xcode 11.3.1
the code in main.dart:
import 'package:flutter/material.dart';
void main() {
runApp(Center(
child: Text(
"hello world",
textDirection: TextDirection.rtl,
),
));
}
flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 1.19.0-4.3.pre, on Mac OS X 10.14.6 18G5033, locale en-US)
[✗] 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.3.1)
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.1.3)
[✓] Connected device (1 available)
! Doctor found issues in 2 categories.
Thanks!
I had a similar problem.
The build from Xcode.app was successful, but the build from the command line or Android Studio failed.
Finally, I reinstalled rbenv, and the problem went away.
In other Github comments, some people solved the problem with conda deactivate, so I think the problem is caused by a bug in the development environment that Xcode.app does not refer to, such as ruby or python environment.

error:Unable to locate a development device; please run 'flutter doctor' for information about installing additional components

while trying to run a simple code using bloc I weren't able to test it because of that error , and before this it takes a lot of time trying to resolving dependencies and then post this error :
Unable to locate a development device; please run 'flutter doctor' for information about installing additional components.
and after running flutter doctor the result is :
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.8.2, on Microsoft Windows [Version 10.0.17134.345], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
X Android SDK file not found: C:\Users\aya sisy\AppData\Local\Android\sdk\build-tools\28.0.3\aapt.
[√] Android Studio (version 3.1)
[√] VS Code (version 1.28.1)
[√] Connected devices (1 available)
! Doctor found issues in 1 category.
Seems like the Android Sdk is not found by Flutter.
Did you set the correct ANDROID_HOME environment variable ?
It could also be coming from the path including a space "...\Users\aya sisy\AppData\...".
Can you try to move it to another location ?
The same problem happened to me, except I'm using Ubuntu 18.04, so check the following:
The solution was to remove adb from apt package manager. so see if you accidentally installed adb for windows other than the one that come with android_sdk.
and from the logs you posted, it's clear that there is something wrong inside the android_sdk path so try to move it to other directory : for ex C:\dev\android_sdk and run the following command
flutter config --android-sdk "C:\dev\android_sdk"
Hoping that helps.
Just check whether your 'Project SDK' is set in File -> Project Structure; under the section Project Settings -> Project.
For me, it was not set by default, and setting it solved the problem.

New Flutter Project wizard not showing on Android Studio 3.0.1

I installed Flutter following official document and also installed Flutter and Dart plugin on Android Studio.
But, I can't see File>New Flutter Project wizard on Android Studio 3.0.1
I run "flutter doctor" command. See the below output.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D102, locale en-TR)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.0)
[✓] IntelliJ IDEA Community Edition (version 2017.3.3)
[!] Connected devices
! No devices available
! Doctor found issues in 1 category.
You need check the “AndroidAPK Support” in your Plugins.
See this screenshot:
If you are sure to have both Dart and Flutter plugins correctly installed, check again your Plugins and be sure that Android APK Support is enabled.
If it isn't, enable it!
Et voilà! Now everything should be fine:
You can find the plugin menu inside the Welcome page
or, when you have a project opened, inside the Preferences menu:
Had the same problem. Check-in Android Studio if the Dart and Flutter plugins are both installed and marked with a lock symbol in Preferences --> Plugins.
Anyway, the following procedure helped me:
uninstall the Flutter plugin
restart Android Studio.
uninstall the Dart plugin
restart Android Studio again which seemed important to do
install the Dart plugin again
restart Android Studio although it is annoying
install the Flutter plugin again
and guess: restart Android Studio
After the last restart I saw the success message:
I assume we both installed both plugins without restarting after Dart.
I also faced it but soon I solved it
I simply install flutter and dart plugins and restarted Android Studio.
After restarting I noticed that there is no Wizard for creating flutter apps. But soon I realized that I have disabled some plugins ( Android Studio's default plugins ) so I enabled all plugins and restarted Android Studio again and BOOM! Now there is a wizard for Creating Flutter Apps.
Hope this helps you !
My answer will be nearly same with #VickyBOSS but I'll upload screenshots of before and after ;)
First and foremost Flutter and Dart plugins must be installed before.
After installing these plugins you can check if it is ok or not with flutter doctor
If you hadn't installed the plugins you would have this:
Android Studio
At first, I didn't see "Start a new Flutter project"
After:
I have also same problem.but what can you do in that situation is Just create the project with command line :
flutter create your_app_name
Now open android studio and open that project. Hope this works well
Yes first update all your plugins related to flutter and dart .
"AndroidAPK Support" plugin(install /enable /update).
3.This will work for all the AS , checked this on AS 3.4 also .
Thanks to the guys who answered before me .
I also ran into this issue and the steps above didn't work. What I did was check which plugins I have enabled and realized that Android APK Support and Android NDK Support was disabled in my AS. After enabling this and restarting android studio everything seems to be working correctly.
This worked for me. Install Dart and Flutter manually from Plugins:
Open Plugins (For Mac: Configure -> Plugins OR Android Studio -> Preferences -> Plugins)
Search for Dart -> Search in repositories -> Install -> Restart Android studio
Search for Flutter -> Search in repositories -> Install -> Restart Android Studio
Got the same problem, fixed it by installing dart first using the plugin manager of android studio. Then install flutter plugin.
How to set flutter wizard in Android Studio 3.0
File > Close Project
Configure > Check for Updates
You will find Flutter and Dart updates. Update and Restart. Downloading Patch.
File > New Flutter Project or Select new Flutter Project.
Hope your problem resolved.
Happy Codings!!
It was little different in my case. After upgrading to newest release of Android studio. The dart flutter and other related plugins were in incompatible mode.
You can check that by going to Android Studio=> Plugins.
I simply update those plugins and then restart the IDE and it works fine.
Just Restore your IDE settings as shown in image
File -> Manage Ide Settings -> Restore default settings
This will remove your installed plugins and ask you again to install them.
Update flutter using below command
flutter upgrade
and again create flutter application from android studio
For some reason, Flutter refused to show New Flutter Project in android studio 3.1
but when I use android studio 3.2 it works fine after installing Dart and flutter plugins.
Make sure you have flutter and dart installed, then enable Android apk support; this helped me
Uninstall Flutter and Dart plugin
Restart Android Studio
Install Flutter Plugin (it will prompt you to install Dart plugin as well. Accept it)
Restart Android Studio
Also, reminder to check whether the plugin is enabled or not. Go to Preferences -> Plugins -> Flutter/Dart. Although, it's enabled by default, you may have had to disable it at some point in the past. In that case, just enable it from Preferences -> Plugin -> Flutter/Dart if you want to.
In my case I did not have APK/NDK support Plugin, added that and it worked. Of course restart IDE couple of times.
Well go to command line and check flutter doctor , if all good give command to your project directory
flutter create appname
and import this to androidstudio , this will generate necessary plugins.
I've got the same problem and finally sorted out. It's usually caused by your upgrade of Android Studio from 2.x to 3.x at the same time.
In short, it's because Flutter is not correctly configurated, but behind the scene there might be different reasons, so the universal solution is to run flutter doctor -v to diagnose and see what's missing.
[First make sure you've already followed the setup steps in Flutter's official documentation and have your Android SDK updated.]
In my own case, a couple of things to fix:
Update the JAVA_HOME path in .bash_profile. Because I have 2 Java versions installed and so I updated it to use the same as Android Studio does. This is critical as flutter doctor relies on Java to check some of your configurations.
Some Android licenses not accepted - follow flutter doctor's advice to accept all licenses.
Android Studio's Flutter plugin version too low - simply update it.
Even if you have done everything here,it may not work if you have Android Studio 4.x or canary
It works only in lower version
In my case I only miss Dart plugin so i installed and on IDE restart it was there

Resources