Unable to create Flutter Project anywhere in windows - flutter

I have made many flutter projects, but suddenly I am unable to create a project. I thought it was an issue with VSCode, so, I installed the latest version. Didn't work! Then I tried in Android Studio. It got stuck at 'Creating Flutter Project'. I even tried in CMD. It remains stuck at
Running "flutter pub get" in note ...
Got TLS error trying to find package cupertino_icons at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 1 in 1 second
This is flutter doctor -v
[√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18363.657], locale en-IN)
• Flutter version 1.17.5 at C:\flutter
• Framework revision 8af6b2f038 (13 days ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\nithi\AppData\Local\Android\sdk
• Platform android-30, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.47.0)
• VS Code at C:\Users\nithi\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.12.2
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
I looked into other answers.
Flutter SDK is stored at C:\flutter
I feel something is wrong with the SDK itself.
Can someone help me with this issue?
EDIT
This is flutter upgrade
Flutter is already up to date on channel stable
Flutter 1.17.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8af6b2f038 (13 days ago) • 2020-06-30 12:53:55 -0700
Engine • revision ee76268252
Tools • Dart 2.8.4

Apologies for the lateness in this.
If this is in a Corporate work environment, there may be a 'man in the middle' security scanning app that's preventing the project from being created.
I was using Flutter just fine until my company instituted 'Zscaler'. Since that got implemented, I'd also freeze at that same error message. I had to turn Zscaler off for my Flutter projects to create.

Related

Strange syntax error with flutter_localizations and intl

Recently (today) I tried to create an app for web and desktop with Flutter and wanted it to be in multiple languages (English, French, Arabic, Dutch...) so I looked at Flutter's tutorial and followed every steps it had. And just after finishing the last step I had it working ! I could add text in, English in the app_en.arb file and in any other language in app_fr.arb by example. When I hot reloaded/restarted my app the Dart files it generates are rebuilt. But now when I do that I have an error that I couldn't find anywhere else on Internet:
Exception: Found syntax errors.
And the dart files for localization weren't rebuilt. Now I must use the
flutter gen-l10n
command to rebuild my language files.
Note:
Here's my flutter doctor:
[✓] Flutter (Channel master, 3.7.0-10.0.pre.33, on Fedora Linux 37 (Workstation Edition) 6.0.12-300.fc37.x86_64, locale fr_FR.UTF-8)
• Flutter version 3.7.0-10.0.pre.33 on channel master at /home/theskyblockman/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cee3e6cc3d (il y a 8 heures), 2022-12-17 04:03:24 -0500
• Engine revision b107699980
• Dart version 3.0.0 (build 3.0.0-35.0.dev)
• DevTools version 2.20.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /home/theskyblockman/Android/Sdk/
• Platform android-33, build-tools 33.0.0
• Java binary at: /home/theskyblockman/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[✓] Android Studio (version 2021.3)
• Android Studio at /home/theskyblockman/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738
• Flutter plugin version 71.0.3
• Dart plugin version 213.7433
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] IntelliJ IDEA Community Edition (version 2022.2)
• IntelliJ at /home/theskyblockman/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/222.4459.24
• Flutter plugin version 71.0.5
• Dart plugin version 222.4459.16
[✓] VS Code (version 1.74.0)
• VS Code at /usr/share/code
• Flutter extension version 3.54.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Fedora Linux 37 (Workstation Edition) 6.0.12-300.fc37.x86_64
• Chrome (web) • chrome • web-javascript • Google Chrome 110.0.5464.2 dev
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
it's me again, this looked like a PATH problem in my case. Now that I restarted my computer I don't have the error anymore, I should have checked that before. But as I never saw this error before you should check other things like dependencies versions or your Dart and Flutter SDKs, I am not sure about how it happened so restart your computer and check a lot of things could help fix the problem.
In my case this error had appeared after I renamed the folder where project files was. I fixed all paths with old folder name, but the error was still persist. flutter clean didn't help.
Then in folder named .idea I found few files (.xml and .iml extensions) that contained the old folder's name. After I fixed it the error was gone. Hope will help.

Flutter and Dart extensions appear to be broken on VSCode

I opened VSCode a few days ago to continue work on a Flutter project, unfortunately, the Flutter and Dart usually take a while to start(2-3 minutes), but this time,the extensions failed to initialize, and I'm left with white colourless code and no access to the tools that come with the extensions(i.e F5 for debug).screenshot of the current state of things
Over the past few days, I have,
Deleted and re-installed the Flutter SDK(forgive me, I cant remember what version it was at before, but now its 3.3.7, Dart 2.18.4)
Deleted and re-installed VSCode(used to be a snap, now a .deb)
Uninstalled and re-installed the Flutter and Dart extensions(multiple times, restarted VSCode each time)
- Ran said project directly from the terminal to be sure I had the flutter tool correctly installed(flutter run and flutter build apk ran fine, with no errors)
Please find the results of 'flutter doctor -v' below
Flutter (Channel stable, 3.3.7, on Ubuntu 20.04.5 LTS 5.15.0-52-generic,
locale en_NG)
• Flutter version 3.3.7 on channel stable at
/home/alabi/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision e99c9c7cd9 (7 days ago), 2022-11-01 16:59:00 -0700
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[!] Android toolchain - develop for Android devices (Android SDK version
32.1.0-rc1)
• Android SDK at /home/alabi/Android/Sdk
• Platform android-33, build-tools 32.1.0-rc1
• ANDROID_SDK_ROOT = /home/alabi/Android/Sdk
• Java binary at: /home/alabi/.jdks/openjdk-18.0.1.1/bin/java
• Java version OpenJDK Runtime Environment (build 18.0.1.1+2-6)
✗ 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.
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[!] Android Studio (not installed)
• Android Studio not found; download from
https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup
for detailed instructions).
[✓] VS Code (version 1.73.0)
• VS Code at /usr/share/code
• Flutter extension version 3.52.0
[✓] Connected device (1 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 20.04.5 LTS 5.15.0-52-generic
The CLI command, 'flutter --version' returns
Flutter 3.3.7 • channel stable • https://github.com/flutter/flutter.git
Framework • revision e99c9c7cd9 (7 days ago) • 2022-11-01 16:59:00 -0700
Engine • revision 857bd6b74c
Tools • Dart 2.18.4 • DevTools 2.15.0
All of this leads me to believe the Flutter SDK is installed correctly and the problem is with VSCode and the extensions
Any help is appreciated, thank you!
Make sure that you use official extensions for Flutter/Dart. They are created by Dart Code.
Fixed!
If something in the extension is corrupt you could try uninstalling the extensions and then deleting them from ~/.vscode/extensions (the ones starting dart-code) and then reinstall.
From DartCode's GitHub, read the issue and fix here if you're still confused

Package Conflict in Flutter how to resolve?

When creating a QR Code reader app in VSCode, I wanted to use two different packages and implement certain functionalities from both, since one package has some functionality that the other does not.
The two packages in question are:
qr_code_scanner
qrscan
While I had been working on the project with only the first (qr_code_scanner) package added to my pubspec.yaml, the project could compile and run. However, once I added the second (qrscan) package to my pubspec.yaml, my project could not compile and would show the error.
\android\app\src\main\kotlin\com\example\qrcodereader\MainActivity.kt: (14, 49): Unresolved reference: onFlutterViewDestroyed
Wondering if it is possible to resolve this issue, or if not possible, how I can restore to a previously working state, since removing either package from my pubspec.yaml does not remove the package from my flutter project.
If required, flutter doctor:
[√] Flutter (Channel stable, 1.22.2, on Microsoft Windows [Version 10.0.19041.572], locale en-US)
• Flutter version 1.22.2 at C:\src\flutter
• Framework revision 84f3d28555 (5 days ago), 2020-10-15 16:26:19 -0700
• Engine revision b8752bbfff
• Dart version 2.10.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\Daniel Seah\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.50.1)
• VS Code at C:\Users\Daniel Seah\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.15.1
[√] Connected device (2 available)

App keeps crashing after recent upgrade to new versions of Flutter( v1.12.13+hotfix.8) and other libraries

App is crashing with following error message in some devices. Its not happening in all devices.
Fatal Exception: java.lang.UnsupportedOperationException
The new embedding does not support the old FlutterView.
io.flutter.embedding.engine.plugins.shim.ShimRegistrar.view (ShimRegistrar.java:82)
io.flutter.plugins.camera.CameraPlugin.registerWith (CameraPlugin.java:54)
io.flutter.plugins.GeneratedPluginRegistrant.registerWith (GeneratedPluginRegistrant.java:47)
com.pickcel.taskmanagement.Application.registerWith (Application.java:22)
com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask.startBackgroundIsolate (HeadlessTask.java:186)
com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask.dispatch (HeadlessTask.java:94)
com.transistorsoft.flutter.backgroundgeolocation.HeadlessTask.run (HeadlessTask.java:88)
Device list :
Xiaomi (Note 7 pro, poco f1, etc)
Samsung (Galaxy M30, S10, A50)
HMD Global (Nokia 4.2, 2.2),
** Mostly with Android OS - PIE(9)
It caused 6K+ crashes till now. I have check the project and i'm not using ShimRegistrar anywhere.
I was also receiving this very same (annoying) errors and also using the background_fetch plugin. Once my app was terminated it wasn't possible to make the background_fetch wake it up without trapping into a FATAL error.
It happens that this plugin was recently updated to a new V2 plugin API standard and it requires that many small changes are made in the "Android side" of your Flutter project.
I strongly recommend that you follow these instructions:
https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
After that please compare your AndroidManifest.xml, Application.java, MainActivity.java and styles.xml files with the ones available at:
https://github.com/transistorsoft/flutter_background_fetch/tree/master/example/android/app/src/main
My Flutter Doctor results in case you want to compare with yours.
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.720], locale en-US)
• Flutter version 1.12.13+hotfix.8 at D:\Tools\flutter
• Framework revision 0b8abb4724 (5 weeks 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 D:\Android\android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\Android\android-sdk
• ANDROID_SDK_ROOT = C:\Android\android-sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code, 32-bit edition
• VS Code at C:\Program Files (x86)\Microsoft VS Code
• Flutter extension version 3.8.1
[√] VS Code, 64-bit edition (version 1.43.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.8.1

Flutter run show previous debugprint?

when i'm running flutter run again it will show previous debug print idk why?
can i fix it?
i want to make print clear for new run
even if i unplug my device it still print previous print
also i already did flutter clean and invalidate cache / restart
this is flutter doctor -v
flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.17134.1184], locale en-ID)
• Flutter version 1.12.13+hotfix.5 at C:\datac\flutter
• Framework revision 27321ebbad (3 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\Ethel\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\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 40.2.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] Connected device (1 available)
• Redmi 4A • 7effb4f17ce4 • android-arm64 • Android 7.1.2 (API 25)
• No issues found!
This does not affect the functionality of the app you are building. It has to do with flutter hot reload feature. If you do a cold PC reboot and do flutter run, after the build process is completed and the app gets installed on your device, you can notice a spinner in your IDE saying "Syncing files to device deviceName..." (This happens once). This process moves files to your device memory which helps in hot-reload. To clear the log, you need to delete those files. And easy but not necessarily a fast way to clear the debugprint will be to:
Reboot your android device or emulator This will clear the memory
or
Use another android device/emulator for testing