I have some errors in flutter installation - flutter

I need some help in solving this problem in flutter installation
i Installed flutter put when running flutter doctor show an error
./flutter/bin/flutter: line 46: /c/src/flutter/flutter/bin/cache/dart-sdk/bin/pub: No such file or directory
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (8 tries left)

Go inside flutter SDK
you have to delete the cache folder inside bin and it will help you.
Thanks!

I dont know whether u downloaded git or not, cloned it or not
so I recommend u to follow step by step as directed on this site-
https://flutter.dev/docs/get-started/install/windows
and the question u asked can be solved if u copy the location of flutter.bin which is located in flutter directory after cloning git, and set path of that particular files in environment variables.
you can find environment variables on right clicking on this pc icon >properties>advanced system setting>environment variables>click on path if dont have create a new path,if having select it >edit >and paste location there.
run flutter doctor.
that's it.

in my case, when I cancel the flutter upgrade in the middle of using an Android Studio then the flutter becomes unreadable again, then when I when the flutter in the terminal will be like this:
... flutter/bin/cache/dart-sdk/bin/dart: No such file or directory
then the solution is quite easy.
go to where the directory folder is / flutter / bin / cache /
Delete the dart-sdk folder
rename the dart-sdk.old folder to dart-sdk only
finished, your flutter is working again.

Related

Flutter failed to delete a directory at "build\flutter_assets"

I've never had this error. The error doesn't appear when I run "flutter run -d chrome" for the initial flutter example but when I add a couple of folders this error appears. thank you for the help
Flutter failed to delete a directory at "build\flutter_assets". The flutter tool cannot access the file or directory.
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.
The build folder is auto-generated when flutter runs. If you created the flutter_assets folder in the build folder, move it to the assets folder instead. (I mixed up the assets and flutter_assets folders in my head.)
I had this issue and wound up manually deleting the entire build folder and running flutter clean (see other suggestions here on SO and here on GitHub).

Could not create task ... this and base files have different roots

I've built an app with Android Studio and Flutter and wanted to generate a signed APK.
When I go to Tools->Flutter->Open Android module in Android Studio, it starts to build the project.
But after some time I get this Error and I don't know how to change the roots or what to do.
It seems like the problem are just two packages (url_launcher and shared preferences)
My Project is on my hard disk F:
and the flutter folder is on my hard disk C:
Error Message "Could not create task..."
Is this maybe because my project is on F: and the flutter folder with the packages in C: ?
How can I change the flutter folder to F: ?
I fixed mine by moving the project directory to the same drive. My project was stored in E:\ so, I moved it to C:.
My answer is almost the same as rvr93's answer but I did not add anything to the environment variables.
Create a directory in the same drive as your project and add PUB_CACHE environment variable. Run flutter pub get.
This worked for me.
I had your same issue, Gradle couldn't sync the android module, I solved it by deleting the android/ directory from the Flutter project, then recreate it using the command flutter create --platforms android .
Notice the "." at the end of the command it's part of it, it means create the Android project in the current directory.
As a workaround, you can do the following steps -
run flutter clean
do the Gradle sync without flutter pub get and make necessary changes to
native android code.
do pub get and run the app.
I have the same issue,
it seems the flutter project and the SDKs are in different prtitions of the hard disk
just go to the project root and run flutter clean
then go to the android folder and delete the .gradle folder
then back to the project root and run flutter pub get
and rebuild the app
As a workaround, you can do the following steps :
Open a terminal.
Run flutter clean.
Do the Gradle sync without flutter pub get and make necessary changes to native Android code or click on try again.
Do flutter pub get and run the app.
You will see that the SHA1 has been generated.
I faced the same issue in my android project after upgrading gradle.
My project was in my D drive, and I had set the destination folder for the generated apk in my desktop, which is in C drive. I changed the destination folder to a folder in D drive, and the issue got resolved.
I was facing the same issue all I did was to go build.gradle file in android folder and then change the following code as follows
dependencies {
//CHANGE THE Version in YOUR BUILD.GRADLE FILE
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
This is a temporary solution - track status here

How to delete then reinstall Flutter

Whenever I have a problem with Flutter I often find answers saying 'reinstall the Flutter SDK'.
However I cannot find any clear instructions on how to do this (please direct me to them if I am wrong).
General Questions
By 'clear' instructions, I mean ones that answer the following questions:
What folder(s) should be deleted to remove Flutter from my computer?
Do any files need to be copied and added to the new Flutter folder once I reinstall it?
Do I need to make any changes to my Flutter projects either before or after reinstalling Flutter?
Will I need to download the same channel (stable, beta, dev, master) as what I am currently on?
Will I need to make any changes to my PATH?
Are these the correct steps to reinstall?
Go to https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
Download the zip of the release you want (safest to use latest stable version)
Open Flutter zip in SAME location as the previous Flutter folder was
Done - I should now be able to run Flutter projects without any further steps
Apologies if these seem like very basic questions but for someone fairly new it isn't obvious what the answers are.
I'm new to Flutter and had similar issues. I will outline what worked for me but meanwhile, to answer your questions:
What folder(s) should be deleted to remove Flutter from my computer?
The Flutter folder which you unzipped and, presumably added to $PATH. Although not deleting it isn't going to pose an issue. I have separate folders of different versions of Flutter on my computer and it's fine.
Do any files need to be copied and added to the new Flutter folder
once I reinstall it?
Try a fresh download of Flutter and unzip it? There is no need to copy or add any files to the Flutter folder once you've (re)installed it.
Do I need to make any changes to my Flutter projects either before or
after reinstalling Flutter?
Not exactly sure what you mean by make changes to your Flutter projects. If you ran flutter doctor and didn't get any errors, then it's good to go. When you create a new Flutter project either in Android Studio, VS Code or Terminal, it will automatically handle whatever file copying business.
Will I need to download the same channel (stable, beta, dev, master)
as what I am currently on?
No, you only need one. I suggest you download one from Stable unless you need web support, which would be Beta.
Will I need to make any changes to my PATH?
After you've unzipped your fresh copy of Flutter (note the folder destination), open Terminal and change the path to said folder destination but make sure it's the /bin folder you're mapping to.
Are these the correct steps to reinstall?
Go to
https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
Download the zip of the release you want (safest to use latest stable
version) Open Flutter zip in SAME location as the previous Flutter
folder was Done - I should now be able to run Flutter projects without
any further steps
Yes and no. You're missing a number of steps. Please follow the full Flutter installation guide depending on your OS.
It took me about 10 hours over two days and a VPN to finally get it working in China with an old install from two years ago when I was in Montréal.

New Flutter projects results in a blank project

This type of steps follws for flutter setup :
1)download latest version of v1.7.8+hotfix.4 this below link
https://flutter.dev/docs/development/tools/sdk/releases
2)my flutter store in this url : C:\src
3)set enviroment variable C:\src\flutter\bin
4)Android studio download and install.
5)install plugin flutter & dart...in android studio...than after restart IDE.
6) than after i have to start a new flutter project
-flutter_demo (project name)
-C:\src\flutter (SDK path)
-C:\src\flutter_project (project location)
my issue is this when i have to create new flutter project only create blank folder in this location [[C:\src\flutter_project]] no any other process.
what is my issue??? i need to help???
this step follow another PC in window 7
--work properly
-but in my pc not working.
-my pc os is also window 7
I also faced with the same problem about creating flutter blank project. In my case, I check the installation steps and all are correct.
The answer is in User Environment Variable Path, there is also old flutter/bin path that I had tested before.
I deleted the old flutter bin path and also in System Environment Variable Path. Then, I can create flutter project and run futter doctor successfully.

Flutter installation not working?

I have installed the flutter folder in Program Files (x86) and have added the .../flutter/bin directory to path. Running flutter doctor in the flutter_console.bat window or just a normal command prompt window gives nothing
and running as admin in either gives me the error:
Updating flutter tool...
\flutter\.pub-cache was unexpected at this time.
What do I do? Thanks in advance for any help.
You shouldn't put Flutter in Program Files. These folders are not writeable by non-Admin users so may fail when trying to write files if you're not running your console/editor as Admin.
Cut flutter folder from Program Files (x86) to Program Files. It has problem with x86 but works fun in x64 directory. And update the environment variables with the new path.
I had mine fixed by just removing the special character from the directory name.
I organize my folders with numbering and parenthesis like so
1) xyz
2) yza
3) aws
...
25) flutter
I changed it to
1) xyz
2) yza
3) aws
...
25 flutter
don't forget to change it in environment variables too
Ok so this is probably not the way to go about it but what I did to solve this problem was remove this line
SET pub_cache_path=%FLUTTER_ROOT%\.pub-cache
from flutter/bin/flutter.bat. I then went through the installation process and once everything was working changed the flutter.bat file back by adding the line again and then ran flutter again. I got no errors from doing this and I appreciate that this is probably not the correct way to go about solving this problem but it worked for me so I am posting it as the answer if others want to try it.
1.Set the environment variable by copying the bin directory ex: C://programfiles/flutter/flutter/bin
2.Go to Control panel -> User Accounts -> User Accounts-> Change environment variables -> Choose User variable -> Path -> Edit -> New -> Paste the link -> click ok
3.Restart Computer -> Open powershell -> Type "Flutter"
4.It should be working now.
1- First make sure that you running cmd or powershell as admin.
2- If didn't work try to restart PC.
3- If didn't work try to move the flutter folder to another path and make sure that you did the required changes on Environment Variables.
4- If didn't work, just delete the cache folder in "flutter\bin" and try again by writing
flutter doctor
Also as a note, try not to put your flutter directory inside the special directories which need a special permissions like Program Files.
I had originally installed it in d:\Program Files (x86) which is NOT the system folder, but an alternate install location that does not require elevated privs, and I was getting this error. I moved flutter to just d:\flutter and it worked. I don't know if it was spaces or the parentheses that was problematic.
Extract the zip file and place the contained flutter in the desired installation location for the Flutter SDK (for example, C:\src\flutter; do not install Flutter in a directory like C:\Program Files\ that requires elevated privileges).
You are now ready to run Flutter commands in the Flutter Console!