Flutter - Error: Null safety features are disabled for this library - android

I have been working on a flutter project for a long time. Now I have set up my new laptop and after reinstalling the tools for VS Code(Flutter, Android Studio) I face the error mentioned in the title of this question.
Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.
As advised, I have set my flutter-sdk version to >= 2.10.0 but it is still not working.
To enable the NNBD I would have to enable experimental support but people advise against it until it is fully released. So what should I do to get my codebase working? Enable NNBD experimental support or is there any other solution?
Here is my flutter doctor:
[√] Flutter (Channel stable, 1.22.3, on Microsoft Windows [Version 10.0.19041.572], locale en-AT)
• Flutter version 1.22.3 at C:\flutter
• Framework revision 8874f21e79 (6 days ago), 2020-10-29 14:14:35 -0700
• Engine revision a1440ca392
• Dart version 2.10.3
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\xyz\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.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)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 4.1.0)
• 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_242-release-1644-b01)
[√] VS Code (version 1.50.1)
• VS Code at C:\Users\xyz\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.16.0
[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 8.0.0 (API 26) (emulator)
! Doctor found issues in 2 categories.
If needed, I will provide extra information/logs/files.

I resolved running flutter clean and flutter pub get again.

Related

Running/Debugging Flutter app very slow after upgrading to latest SDK version 1.20.4

I'm facing this problem after upgrading to latest stable version 1.20.4
Earlier I was using Flutter 1.12.13+hotfix.5 and debug/run speed was good enough.
Is anyone else also facing this issue? Or could anyone help by suggesting some solutions or reasons as to why this is happening?
I am using a Windows 10 machine.
Running flutter doctor -v yields the following output
• Flutter version 1.20.4 at D:\flutter
• Framework revision fba99f6cf9 (8 days ago), 2020-09-14 15:32:52 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\amani\AppData\Local\Android\Sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\Users\amani\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_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 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.49.1)
• VS Code at C:\Users\amani\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.14.1
[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!```
i had a simular issue , for me i return to the previous stable version and everything goes good ,
run flutter downgrade to return to the previous fluter version install on your machine
Solved the issue by deleting Flutter SDK and then replacing it with newly downloaded SDK.
It seems that upgrade caused some files to get corrupted in the SDK directory.

when ever I try to run my Flutter program, it gets stuck at “Running Gradle task 'assembleDebug”

whenever I try to run in on an Emulator or on a real device, it get stuck at “Running Gradle task 'assembleDebug” and the entire computer just freezes and get stuck, and the only way out is to hard reboot it.
I'm using an Asus laptop ( windows 10 ), with 16GB ram.
flutter --version gives: (when I try flutter upgrade it gives same result and says I have the latest version)
Flutter 1.20.0-1.0.pre.42 • channel master • https://github.com/flutter/flutter.git
Framework • revision 401690a64f (2 days ago) • 2020-06-12 19:45:48 -0700
Engine • revision 965fbbed17
Tools • Dart 2.9.0 (build 2.9.0-14.0.dev 2b917f5b6a)
when I run flutter doctor I get this output in the terminal: UPDATED
C:\Users\Lidor>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 1.20.0-1.0.pre.42, on Microsoft Windows [Version 10.0.18362.900], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 4.0)
[√] IntelliJ IDEA Community Edition (version 2019.2)
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
when I run flutter doctor -v I get this output:
C:\Users\Lidor>flutter doctor -v
[√] Flutter (Channel master, 1.20.0-1.0.pre.42, on Microsoft Windows [Version 10.0.18362.900], locale en-US)
• Flutter version 1.20.0-1.0.pre.42 at D:\Study\P.Languages\Flutter\flutter_windows_v1.7.8+hotfix.4-stable\flutter
• Framework revision 401690a64f (2 days ago), 2020-06-12 19:45:48 -0700
• Engine revision 965fbbed17
• Dart version 2.9.0 (build 2.9.0-14.0.dev 2b917f5b6a)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at D:\Lidor\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
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/docs/get-started/install/windows#android-setup for detailed instructions.
[√] Android Studio (version 4.0)
• Android Studio at D:\Program Files\Android\Android Studio
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] IntelliJ IDEA Community Edition (version 2019.2)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2
• Flutter plugin version 38.1.4
• Dart plugin version 192.5728.98
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
I also tried to run flutter channel master as it suggested here and also everything here
There are lots of reasons why it's happening: Did not accept android-licenses, incompatible version of sdk/flutter, Windows Firewall etc.
If you haven't tried:
Updated file android/app/build.gradle with
compileSdkVersion 29
Run:
flutter clean
Otherwise check Flutter App stuck at "Running Gradle task 'assembleDebug'... "
Or if your Android license status unknown.
Android Studio installs without sdkmanager
Uncheck Hide Obsolete Packages and you'll see Android SDK Tools (Obsolete) 26.1.1.
and then flutter doctor --android-licenses
in my case I just run flutter upgrade

FLUTTER ERROR sdkmanager error!!! Windows 10

AndroidStudio is updated everything is updated I think error come from here C:\Users\lanet\AppData\Local\Android\sdk\tools\bin\sdkmanager because this folder couldnt created when I looked to there I'm waiting for advises . thank you
C:\Users\lanet>flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.592], locale tr-TR)
• Flutter version 1.12.13+hotfix.8 at C:\src\flutter
• Framework revision 0b8abb4724 (3 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.3)
• Android SDK at C:\Users\lanet\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• 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_212-release-1586-b04)
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.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 (version 1.42.1)
• VS Code at C:\Users\lanet\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.8.1
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
C:\Users\lanet>flutter doctor --android-licenses
Android sdkmanager tool not found (C:\Users\lanet\AppData\Local\Android\sdk\tools\bin\sdkmanager).
Try re-installing or updating your Android SDK,
visit https://flutter.dev/setup/#android-setup for detailed instructions.
Scroll down and Download Command line tools only from this link.
Put your Downloaded file (tools) in this location:
C:\Users\ABC\AppData\ABC\Android\Sdk
Close your android studio , and again open android studio. And check update.
Open command line and pass:
flutter doctor --android-licenses
And press y for accept.
Run flutter doctor you should be good.

flutter embedding - Upgrading Pre 1.12 Android Projects Breaks Plugins

While building my flutter project, I was forced to follow the instructions in this link https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects for my shared_preferences package to work.
I followed the instructions there. Now my plugins seem to not work. for example signing with google throws this error: error MissingPluginException(No implementation found for method init on channel plugins.flutter.io/google_sign_in)
Similar errors happen with almost all of my plugins.
here is my flutter doctor -v logs
• Flutter version 1.10.15-pre.404 at C:\src\flutter
• Framework revision 9093cf15f6 (2 hours ago), 2019-11-04 22:30:16 -0500
• Engine revision 7b968ff95f
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
• Android SDK at C:\Users\Ajmal Jalal\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.1
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
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 Studio1
• Flutter plugin version 41.0.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.39.2)
• VS Code at C:\Users\Ajmal Jalal\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.5.1
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
! Doctor found issues in 1 category. ```
This question was answered here in flutter's github page, and the answer there resolved my issue:
https://github.com/flutter/flutter/issues/44161

Flutter.dev and the problem with macOS Catalina (Gatekeeper)

since I upgraded my MacBook to macOS Catalina. I'm getting permanent the message ("ideviceinfo" could not be open, because the developer is not verified) despite I disabled the "spctl". can somebody help please?
I downloaded the flutter version flutter_macos_v1.9.1+hotfix.4-stable.zip AND i use the Andriod Studio 3.5.1.
[✓] Flutter (Channel stable, v1.9.1+hotfix.4, on Mac OS X 10.15 19A583, locale de-DE)
• Flutter version 1.9.1+hotfix.4 at /Users/yousefmosa/0/prg/flutter
• Framework revision cc949a8e8b (2 weeks ago), 2019-09-27 15:04:59 -0700
• Engine revision b863200c37
• Dart version 2.5.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/yousefmosa/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Xcode - develop for iOS and macOS (Xcode 11.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.0, Build version 11A420a
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install:
sudo gem install cocoapods
pod setup
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 40.1.2
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] IntelliJ IDEA Community Edition (version 2019.1.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 37.0.3
• Dart plugin version 191.7830
[✓] VS Code (version 1.37.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.3.0
[✓] Connected device (1 available)
• iPhone 11 Pro Max • XXX-6B2F-XXX-9B01-XXXXXX • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-0 (simulator)
! Doctor found issues in 2 categories.
From macOS "System Preferences..." > "Security & Privacy" > "General" tab ,
you see the dart entry. Just press "Allow Anyway"
Go to System preferences -> General and allow "dart" to run
Type these command in terminal
sudo xattr -d com.apple.quarantine YourflutterSDKLocation/bin/cache/artifacts/libimobiledevice/ideviceinfo
This is because of recent changes in macOS Catalina.
sudo spctl --add "Path_to_flutter/bin/cache/artifacts/libimobiledevice/ideviceinfo"
You might need to reboot the system in order to apply the changes.
You can run a GateKeeper script to fix the issue.
I have published an article with more information how to fix this.

Categories

Resources