I am unable to build my flutter web project - flutter

When trying to run flutter build web i get "build web" is not currently supported.
I had previous errors where i was stuck with Dart 2.5.0-dev.4.0.flutter-be66176534 and required 2.5.0 or higher, this has now been solved but i am unable to build my project.
flutter doctor -v
[√] Flutter (Channel stable, v1.9.1+hotfix.2, on Microsoft Windows [Version 10.0.18932.1000], locale en-GB)
• Flutter version 1.9.1+hotfix.2 at C:\src\flutter
• Framework revision 2d2a1ffec9 (8 days ago), 2019-09-06 18:39:49 -0700
• Engine revision b863200c37
• Dart version 2.5.0
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\germa\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[!] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[√] VS Code (version 1.38.1)
• VS Code at C:\Users\germa\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.4.1
I have tried
re-installing dart
re-installing flutter
re-installing Visual Studio code
copy file contents to a new web project (same error)
I couldn't find any information on what this is caused by and how to resolve it online
What can i do to resolve this error?

Please once do configure like below
flutter channel stable
flutter upgrade
flutter config --enable-web
cd into project directory
flutter create .
flutter run -d chrome

So currently you are at stable channel . You have to switch to the beta channel as flutter web is not at a stable channel right now. In order to make it working run the following commands in the terminal.
flutter channel beta
flutter upgrade
flutter config --enable-web.
After that restart your IDE and build the web app.

I was facing problem in flutter stable 2.0.2, by running
flutter create .
it was not creating web module, after upgrading it has started working. I guess my flutter web sdk had some issue so by fresh upgrade it got fixed.

if your are facing the problem
Ambiguous organization in existing files: {package_name1, package_name2}. The --org command line argument must be specified to recreate project.
you can use this command
flutter create --org package_name1 .
And
flutter run -d chrome

Just check whether you have used any plugins in pubspecs.yaml that is nonweb supportive.

you have to add web support to an existing app:
flutter create .
then try to
flutter build web

Related

Flutter I can't release or debug when I add Connectivity

SOLUTION for this problem
I deleted the JDK 13. I installed JDK 8.
I gave the environment variable for the Flutter SDK. in user variables
flutter
C: \ flutter \ bin
I gave the environment variable for JAVA_HOME. in system variables
JAVA_HOME
C: \ Program Files \ Java \ jdk1.8.0_241
Then I accepted Android licenses with cmd.
(flutter doctor --android-licenses)
Now I can use flutter connectivity.
The problem is solved. Thank you.
-------------------------------------------------
I cannot debug or release to my app when I add Connectivity to my app's pubspec.yaml
Flutter Doctor
[flutter] flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.657], locale tr-TR)
• Flutter version 1.12.13+hotfix.8 at C:\flutter
• Framework revision 0b8abb4724 (9 days ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\Faruk Aydin\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Java\jdk-13.0.2\bin\java
• Java version Java(TM) SE Runtime Environment (build 13.0.2+8)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[!] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
X Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[√] VS Code (version 1.42.1)
• VS Code at C:\Users\Faruk Aydin\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.8.1
[√] Connected device (1 available)
• Redmi 8A • f12007c00606 • android-arm • Android 9 (API 28)
! Doctor found issues in 2 categories.
exit code 0
I deleted the JDK 13. I installed JDK 8.
I gave the environment variable for the Flutter SDK. in user variables
flutter
C: \ flutter \ bin
I gave the environment variable for JAVA_HOME. in system variables
JAVA_HOME
C: \ Program Files \ Java \ jdk1.8.0_241
Then I accepted Android licenses with cmd.
(flutter doctor --android-licenses)
Now I can use flutter connectivity.
The problem is solved. Thank you.
You need to create a global file under your username in Mac. Just create a .bashprofile file as described bellow:
Open to see location and locate your flutter sdk inside.

Flutter fresh installation flutter run stuck

I am new to flutter i have fresh installtion.
All as in docs.
As after fresh installation i was fine worked but when i want to work on another day flutter run i stuck.... I do not know why. I only make boilerplate app. I xcode when i build app is opening in simulator but stating as flutter run not working. I even try to wait 20 min with this flutter run but still stuck
flutter doctor -v
[✓] Flutter (Channel master, v1.6.4-pre.14, on Mac OS X 10.14.5 18F132, locale
pl-PL)
• Flutter version 1.6.4-pre.14 at /Users/db/Desktop/Mobile/flutter
• Framework revision 81c38b22cb (32 hours ago), 2019-05-24 22:51:02 -0400
• Engine revision 8dc3a4cde2
• Dart version 2.3.2 (build 2.3.2-dev.0.0 e3edfd36b2)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/db/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2.1, Build version 10E1001
• CocoaPods version 1.7.0
[✓] iOS tools - develop for iOS devices
• ios-deploy 1.9.4
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 35.3.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b01)
[✓] Connected device (1 available)
• iPhone 8 • F35EFD3E-C637-427A-8405-30EDF202939A • ios •
com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)
• No issues found!
flutter run -v stuck at this stage.
+file:///Users/db/Desktop/Mobile/flutter/packages/flutter/lib/widgets.d
art
[ ] -> +file:///Users/db/Desktop/Flutter/iamsmart/lib/main.dart
[ ] -> 35191e22-84d6-4fab-abef-178ae9e4c665 build/app.dill 0
[ +319 ms] Building bundle
[ ] Writing asset files to build/flutter_assets
[ +55 ms] Wrote build/flutter_assets
[ +12 ms] Using legacy Xcode build system.
[ +27 ms] executing: [/Users/db/Desktop/Flutter/iamsmart/ios/]
/usr/bin/xcodebuild -list
Run this command
flutter clean
And then again
flutter run
Try to upgrade your flutter version to v 1.7.8 by running this
command this needs internet connection
flutter upgrade
Try this command
flutter clean
Change your flutter channel to stable
flutter channel stable
Check your internet connection because sometimes it prevents me from
running my app
Try to switch your flutter channel master to stable channel. After switching the channels you should call flutter upgrade to download the Flutter SDK and dependent packages.
Do this steps in the terminal
flutter channel stable
flutter upgrade
try to run your code after this steps.
Update to 1.9.1-hotfix4 fixed the problem
Your flutter doctor isn't showing any error as you had shared the commands.I think to share the run command terminal so that we can find out the stack of flowing of commands.
If you are getting error to build flutter project then you should update the Android Studio or VS Code Editor.
You can refer here:
Android studio-https://developer.android.com/studio
VS Code-https://code.visualstudio.com/Download
If you are able to create flutter project but doesn't getting run command then you need to update flutter and dart.
You can refer here:
Flutter-https://flutter.dev/docs/development/tools/sdk/releases
Dart-https://dart.dev/get-dart
If still you are suffering from error then you need to share some more Pics.
Probably something's gone wrong after you changed some files in of flutter ide. Also it does after updates crashed.
So the thing you should do is firstly backup your projects if it indeed. After backup remove the ide and be sure uninstalling complate succesful. Restart your computer and install all decencies again. Because sometimes upgrading does not works well to get good result.
P.S : Dont forget using flutter doctor for checking if any problem comes out.

Unable to locate a development device; please run 'flutter doctor' .. but doctor checks out ok

A new installation of flutter/dart went smoothly without issue .. running "flutter doctor -v" gives the following output:
$ flutter doctor -v
[✓] Flutter (Channel beta, v0.11.9, on Linux, locale en_AU.UTF-8)
• Flutter version 0.11.9 at /home/jedaa/bin/flutter
• Framework revision d48e6e433c (3 days ago), 2018-11-20 22:05:23 -0500
• Engine revision 5c8147450d
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.2)
• Android SDK at /home/jedaa/bin/Android/sdk
• Android NDK location not configured (optional; useful for native
profiling support)
• Platform android-28, build-tools 28.0.2
• ANDROID_HOME = /home/jedaa/bin/Android/sdk
• Java binary at: /opt/android314/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-
b06)
• All Android licenses accepted.
[✓] Android Studio (version 3.2)
• Android Studio at /opt/android314
• Flutter plugin version 30.0.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-
b06)
[✓] IntelliJ IDEA Community Edition (version 2018.2)
• IntelliJ at /opt/idea
• Flutter plugin version 30.0.2
• Dart plugin version 182.5124
[✓] VS Code (version 1.29.1)
• VS Code at /usr/share/code
• Flutter extension version 2.20.0
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
and yet attempting to run the defalut starter app "flutter/material.dart" results in ... "Unable to locate a development device; please run 'flutter doctor' for information about installing additional components" ... irrespective whether i use Intellij or Visual Studio.
However,
$ flutter devices
1 connected device:
Pixel XL • HT69R0205363 • android-arm64 • Android 9 (API 28)
I have searched the web and found similar complaints .. but no solution. I was hoping that someone might be able to throw some light on this as I am sure it must be something simple and straight forward.
Visual Studio is a new installation but I have been using Intellij now for 6 months on a daily basis and rarely have issue with it .. especially one that i cannot fix. :)
Thank you in advance.
open Terminal in Android Studio or VS Code.
and writes this command :
flutter config --android-sdk <sdk-location>
SDK-location is your Path for SDK! for Example :
flutter config --android-sdk /home/sanaebadi/Pasport/programming/and_dev/sdk/sdk-tools-linux-3859397/
I had the same problem , then I tried this solution , and it helped me and my flutter app is running on my phone ..
all you need to do is install Android API level 29 (Android 9.0+ "Q")
go to Setting > Android SDK >SDK platform>Check Android 9+ and Press Apply button
I found this solution from github .. her is the link ..
Hope this help you
https://github.com/flutter/flutter/issues/22649#issuecomment-520472515
In Android Studio, ensure that the API level of your Project SDK (File->Project Structure) <= of the API level of your AVD.

Flutter with VSCode shows not installed even though its installs

I just getting with flutter. I have installed it along created a project successfully.
But when I try to run it fails.
Below is the output with flutter doctor -v
PS C:\android-app\flutter-app\flutter_first_app> flutter doctor -v
[√] Flutter (Channel master, v0.5.5-pre.9, on Microsoft Windows [Version 10.0.16299.461], locale en-US)
• Flutter version 0.5.5-pre.9 at C:\android-app\flutter
• Framework revision 587569337e (7 hours ago), 2018-06-13 00:02:21 +0200
• Engine revision a328531402
• Dart version 2.0.0-dev.60.0.flutter-a5e41681e5
[!] Android toolchain - develop for Android devices (Android SDK 28.0.0)
• Android SDK at C:\Users\Sreyah Admin\AppData\Local\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.0
• ANDROID_HOME = C:\Users\Sreyah Admin\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
X Android license status unknown.
[√] Android Studio (version 3.1)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[!] VS Code, 64-bit edition (version 1.24.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected devices (1 available)
• XT1706 • HKE63YLL • android-arm • Android 6.0 (API 23)
I have installed the Flutter extension.
I tried uninstall and install a couple of time, but still the same result.
I think there are two issues here:
Doctor says you don't have the extension
Your project doesn't run
1 Doctor says you don't have the extension
This is a bug I've just fixed. Seems like VS Code may have started lower-casing the extension folders recently, and our test for them was case sensitive. The fix is in master but hasn't made the beta channel (as of 22nd June 2018).
Note: This check doesn't affect anything else, as long as the extension is installed this is just an issue with the doctor output.
2. Your project doesn't run
This is probably not related to the doctor output if you can see the extension in VS Code. You haven't included any info on the reason your app doesn't run (does it give an error? what do you see?) so it's hard to guess; but if you can provide that info I can take a stab.
If you haven't already, it's also worth running the project from the command line with flutter run to see if it works there, to see whether the issue is specific to VS Code or something else with your setup.
If if works from the command line then I would recommend opening an issue on GitHub for the Dart-Code repo with more information and we can track it down from there.
Open your VS Code if you have it installed, if not you can still install it from the link. Flutter internally use Dart language to build a mobile app. So you need to install this extension
Then open this link "https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter" to install this extension.
After the installation run your flutter doctor -v to confirm.

Android SDK is missing command line tools

I've installed flutter but when I run flutter doctor to verify the installation, I get:-
Android SDK is missing command line tools
I've doubled checked that the command lines are installed.
What do I need to do remove this error?
I've included the full flutter doctor -v output below:-
$ flutter doctor -v
[✓] Flutter (Channel beta, v0.3.1, on Mac OS X 10.13.4 17E202, locale en-AU)
• Flutter version 0.3.1 at /Users/chris/flutter
• Framework revision 12bbaba9ae (2 weeks ago), 2018-04-19 23:36:15 -0700
• Engine revision 09d05a3891
• Dart version 2.0.0-dev.48.0.flutter-fe606f890b
[!] Android toolchain - develop for Android devices
• Android SDK at /usr/local/Caskroom/android-platform-tools/27.0.1
• Android NDK location not configured (optional; useful for native profiling support)
• ANDROID_HOME = /usr/local/Caskroom/android-sdk/3859397
✗ Android SDK is missing command line tools;
• Try re-installing or updating your Android SDK,
visit https://flutter.io/setup/#android-setup for detailed instructions.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.3, Build version 9E145
• ios-deploy 1.9.2
• CocoaPods version 1.5.0
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 24.1.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 24.1.2
• Dart plugin version 181.4668.60
[!] Connected devices
! No devices available
! Doctor found issues in 2 categories.
On Android Studio open SDK Manager.
Go to SDK Tools tab.
Check if Android SDK Command-line Tools is checked. If not, check and apply the changes.
For some reason, after updating flutter and Android Studio, I got this error too. Seems like some new requirement that for some reason wasn't automatically installed.
This fixed it for me.
I think ANDROID_HOME and ANDROID SDK should be pointing to the same path and that is the SDK's root directory.
In my .bashrc (on LINUX), following are
export ANDROID_HOME=/home/myname/Android/Sdk
export PATH=/home/myname/Android/Sdk:$PATH
export PATH=/home/myname/Android/Sdk/platform-tools:$PATH
export PATH=/home/myname/Android/Sdk/tools:$PATH
export PATH=/home/myname/Android/ndk-build:$PATH
Just solved the problem. Here are my system settings:
System variable ANDROID_SDK_ROOT points to my Android SDK dir
In system Path variable, I have sdk/tools, sdk/platform-tools, and /flutter-dir/bin
Also make sure you don't have dulplicated directories. I previously downloaded another platform-tools and add it to Path, so I had to delete it and use the sdk's one.
After changing those things, I close the flutter cmd windows and run flutter doctor on PowerShell. Worked like a charm!
Please download the latest sdk build-tools to solve the problem of Android SDK is missing command line tools