New Flutter projects results in a blank project - flutter

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.

Related

Flutter run and clean error "Flutter failed to delete a directory" when project is in synced folder

Full error:
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.
Error occurs when trying to run flutter run -d chrome with these notes (all on new freshly created projects):
If the project is located in C: drive - it works always
If the project is located in D: drive inside a synced D:\Google Drive\ folder, then it throws the error on 2nd run.
If the project is located in D: outside of the synced folder - it works always
However, I need it to run inside the synced folder, since I am using multiple locations and computer for development of a project.
Flutter 3.3.2 • channel stable. Only using for Chrome device (web dev). I am using Windows 10. Flutter installed on D:\src\flutter.
List of things I have tried:
Moving build folder contents to the assets folder instead. Result: runs once, but any additional runs throw the error again. As suggested here.
flutter clean Result: throws same error
Running flutter clean with cmd as an administrator. Result: same error
Deleting the folder manually. Result: complains about another folder with the same error. Once I manually delete all of the ones it complains about, it runs once, but any additional runs throw the error again.
Restarting computer
Even tried giving Everyone full-access permissions to the project folder.
Tried installing flutter in different location C:\src\flutter
I been trying to solve this for days and none of the answers I found on the internet work.
Flutter doctor output: https://pastebin.com/9XpHW7T8
EDIT: Tried a few more things and added them to the list.
EDIT2: Added another thing I tried.
EDIT3: Added flutter doctor output.

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 come "flutter create ." adds desktop support?

I created a Flutter project within Android Studio, and then later found out that Flutter supports desktop. After searching the web, I did things like switching to "dev", adding config for desktop, etc. But when I tried to ran it, I got "No Windows desktop project configured", even though I enabled the configuration.
The documentation page had
To add desktop support to an existing Flutter project, run the following command in a terminal from the root project directory:
flutter create .
This adds the necessary desktop files and directories to your existing Flutter project.
But what is the meaning of .? How come that . means "adding desktop support"?
The command to add desktop support are those one:
flutter config --enable-windows-desktop
flutter config --enable-macos-desktop
flutter config --enable-linux-desktop
Once you used them, you change your flutter config.
Then, the usage of flutter create . simply mean "Create a new flutter project in my current folder".
If you're already in a Flutter project, it will just "recreate" your project by adding the new support for Desktop since you specify in your flutter config.
flutter config --enable-[windows,linux,macos]-desktop
flutter create .
if there is some error with second command, remove - sign from parent folder name, and run this command:
flutter create --org com.example.myapp .
Run this command it works fine for me.
run
flutter config --enable-windows-desktop
then run
flutter create .
if flutter create . generate error, probably there is - in your root project directory.
for example it will generate error if your project is like below
Alewa-Stock
to work it fine rename your project directory like below
alewa_stock
then run the following command
flutter create --platforms=windows --org=com.alewa.store .
*
NB: Please change the name according to your preference.
flutter create --platforms=windows,macos,linux .
you can use this line instead

Flutter does not working even after Path update

I tried to install flutter, i followed excat steps in official docs. Installed SDK from github and added path to my bashrc file, As shown below picture, even though path successfully updated, flutter commands not recognizing and not working.
https://imgur.com/a/WfQ88J0
1
I recommend clearing the android-studio-dir and android-sdk settings, and let flutter automatically detects their path instead: This works for me .
flutter config --android-studio-dir=""
flutter config --android-sdk=""

I have some errors in flutter installation

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.