Flutter simply showing 'sysctl -n hw.optional.arm64' returned unexpected output: '' - flutter

Not sure which details are relevant so I'll include as many as possible.
Had to upgrade flutter today and instead of working when I typed in 'flutter upgrade' into android studios terminal/Iterm2/terminal zsh I was met with the following response.
'sysctl -n hw.optional.arm64' returned unexpected output: ''
When I search for this issue the only thing i can find is this post which states that sysctl can't be found. The path does appear to be in my .zshrc but still not working. I can't use which or where sysctl as it just says 'sysctl not found'
When I try to upgrade flutter through brew (brew install --cask flutter) it downloads fine but on installing it throws the following error:
==> Purging files for version 3.3.5 of Cask flutter
Error: It seems there is already a Binary at '/opt/homebrew/bin/dart'.
I can't continue working as I need the new flutter version and it seems the web doesn't have much to show for this particular error.
I can't flutter --version, flutter doctor or anything of the sort as I just get the same message.
I'm using:
MacOS monterey 12.6 macbook air.
Android studios
Iterm2
Ohmyzsh
When I open android studios it shows me the following:
"Flutter device daemon #1 exited (exit code 1), stderr: 'sysctl -n hw.optional.arm64' returned unexpected output: '' in a pop up window.
Pubspec has been edited > get dependencies > Upgrade depenedencies: Both of which have the same error as in the title.
The current configured flutter SDK is not known to be fully supported. Please update your SDK and restart intelliJ which I think is what I've been trying to do.

This is an answer I hope will be helpful for others who have the same issue.
Other answers suggested a fix by just updating the path document (.zshrc) but this is what helped me as that did not and my paths were up to date.
Sadly, it's as simple as manually deleting all my flutter SDK files locally. Downloading them again (this time the latest one) and unzipping it into the same place. Didn't even have to update the path).
Worked a charm, issues appear to be all gone except that the dialogue in android studios is still saying that there are dependencies that need getting and upgrading (but doesn't go away even when I've run it).

I solved it by removing the old flutter SDK, downloading the latest version, and setting it up again.
it works perfectly for me!

Related

Flutter SDK 0.0.0-unknown [xcrun: error: invalid active developer path] after MacOS Ventura update

I upgraded my software yesterday to MacOS Ventura. Today when I opened my project so I can work on it, I cannot get to build the app because I get this error: The current Flutter SDK version is 0.0.0-unknown.
Running "flutter pub get" in elfi_menu...
The current Flutter SDK version is 0.0.0-unknown.
Because country_icons 2.0.2 requires Flutter SDK version >=0.1.4 and no versions of country_icons match >2.0.2 <3.0.0, country_icons ^2.0.2 is forbidden.
So, because elfi_menu depends on country_icons ^2.0.2, version solving failed.
pub get failed (1; So, because elfi_menu depends on country_icons ^2.0.2, version solving failed.)
Exited (1)
I have tried to reinstall flutter, I get the same error, I also tried opening a new project, same error. I also looked it up on the internet but I saw pretty old similar issues, they are fixing it on Windows and it is not the same here on mac from what I've seen.
Does anyone have any ideas why this happened and how to fix it?
Thank you very much in advance
EDIT
Above the output I have written in the code, this is a line that appeared:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
I searched for the solve on the internet and this like solves the problem, written in the terminal:
xcode-select --install
This fixed it for me:
Open Xcode
Go to Preferences
Go to Locations
Use the "Command Line Tools" dropdown to select the available Command Line Tools
Mine was empty and I chose the single available option: "Xcode 14.0.1 (...)"
Restart console, everything should be working
To solve the problem, I have written this in the terminal:
xcode-select --install
source: https://apple.stackexchange.com/questions/254380/why-am-i-getting-an-invalid-active-developer-path-when-attempting-to-use-git-a

Invalid argument(s: A directory corresponding to fileSystemPath /Users/user/.pub-cache/hosted/pub.dartlang.org/devtools-2.9.2/build could not be found

Somehow the "build" directory doesn't exist within devtools-2.9.2 directory. I am getting this exception only while running the build on iPhone SE 2nd generation iOS 14.5 simulator though, which is weird. This began after an unexpected forced reboot of my mac. But I can not directly connect this event.
What is happening and how can I build this stuff or get rid of exceptions? And what is the cause?
flutter doctor -v No issues found
It seems like the new 2.9.2 release doesn't have the required "build" folder.
You can try fixing it by running this in the terminal:
dart pub global activate devtools -v 2.8.0
which downgrades the version to 2.8.0 (that works fine).
Answer from github.
run the following code and it'll get solved.
dart pub global activate devtools -v 2.8.0
DevTools is no longer being shipped via pub and is now part of the Dart SDK. 2.9.2 was published unintentionally this morning and has since been retracted.
How were you starting DevTools? You might want to file an issue on the DevTools repository if you're still having issues and I (#bkonyi) can help you out further there.

Can't run flutter project due to error VERBOSE.dart error, isolate error

When I try to run my flutter-project code on the iOS simulator in VS code, I get the following error on the console:
Launching lib/main.dart on iPhone 11 Pro in debug mode...
lib/main.dart:1
Xcode build done. 24.4s
[VERBOSE-2:shell.cc(103)] Dart Error: Can't load Kernel binary: Invalid SDK hash.
[VERBOSE-2:dart_isolate.cc(171)] Could not prepare isolate.
[VERBOSE-2:runtime_controller.cc(415)] Could not create root isolate.
[VERBOSE-2:shell.cc(588)] Could not launch engine with configuration.
Thanks in advance.
Hi!
In my case, the error was caused by the forced shutdown of the IDE.
After manually selecting the libraries, I identified the one that was causing the problem, updated the project without it, and updated the project again with it.
With that the problem was solved.
Hope I have helped, if yes, please flag.
Could you delete the bin/cache folder, then run app
Open terminal and run: $ flutter channel beta
"it will install beta version, once installation is done, try it!"
"In case you willing to change the beta version to stable version you can use the following:"
$ flutter channel stable

ERROR with flutter: CocoaPods not installed even if it is installed

I am trying to run my code on AndroidStudio by using Flutter but when I run it shows an error:
Warning: CocoaPods not installed. Skipping pod install. 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 see
https://guides.cocoapods.org/using/getting-started.html#installation
for instructions.
CocoaPods not installed or not in valid state. Error launching
application on iPhone 11.
flutter doctor shows that all is fine, I looked around a lot and tried lots of things like uninstall it and install it again, and tried adding:
dev_dependencies:
build_runner: ^1.10.0
dependency_overrides:
analyzer: 0.39.14
and tried
flutter channel stable
flutter upgrade
and tried
flutter channel master
flutter upgrade
But nothing worked, note that when I write "which pod" it shows the path, that means it exists right? then what is the problem? please help :(
have you tried to run pod install from the ios folder?
The only thing that worked with me is using android emulator, ios simulator still show the same error
I had the same issue and I found a solution, but with still an answered question. See my question (and one partial solution) here
The partial solution is: in Android Studio, click on the tab "Terminal" at the bottom of the IDE and in this pane, type flutter run. It does the same as the button Run, and Android Studio stopped complaining about CocaPods.
To stop the app, type q in the same terminal.

new flutter project in vscode has error

when i create a new flutter project in vscode it will immediately shows an error in the main.dart file and gives a gradle error when trying to debug.
shown here: main.dart error
"compiler message: lib/main.dart:68:19: Error: Too few positional arguments: 1 required, 0 given."
I've reinstalled dart and flutter plugins. updated the java install.
in debug console i get this:
debug console
added output of flutter doctor -v
enter image description here
I was also facing the same error, but it was always on my test folder.
This is what I did:
On your terminal, make sure you are in your project repository.
Run the flutter pub get command, it worked for me, may be you
should try it too.
Do you possibly have two different versions of the Flutter SDK on your machine? I wonder if one is being used by flutter create and the other for analysis.
If you're sure you only have one, please open an issue on GitHub and attach a log file for me to investigate.