Flutter does not generate a lib/main.dart - visual-studio

After opening a simulator, when I run:
flutter create first_app
on my Dev folder directory in my User account, and then I run:
cd first_app
flutter run
I am given an error message saying that there is no lib/main.dart directory, which is true; flutter didn't create a main file/method for me.
This consequently makes it impossible to run the app. I am only starting out with Flutter, so I have yet to learn how to create a main method etc...
My visualstudio code has already installed the Flutter Plugins.

Related

shared preferences don't work on ios [Xcode Debug]

I am trying to save the data locally in my application trying to use the shared preferences, while on android and chrome everything is ok, on ios by problems. When I debug with xcode this warning comes out "shared_preferences_ios not found".
Follow this steps
Backup ios/Runner folder.
Delete the ios folder.
Run flutter create (your project name). in the previous folder where you have your project(cd users/user/"projects_folder") (this will recreate your ios folder).
Paste your Runner backup in the ios folder (into the project).
Open Runner.xcworkspace (into ios folder) and there, check the Version, the Bundle ID, all the info.
(If do you Have Firebase, you have to copy and paste again the Google Service-Info.Plist into the Runner folder (Always through Xcode) (If do you do this manually, it doesn't work).
Finally, flutter run and should work!
If flutter run fails:
cd ios
pod install
cd ..
flutter run

Xcode 13 Debug-iphonesimulator/YogaKit/YogaKit.modulemap not found for a brand new project just initialized

A brand new React Native 0.66 app was created with command below:
npx react-native init myapp
The app was launched successfully with npx react-native run-ios. In Xcode 13, the myapp.xcodeproj is opened to test if the build will pass. To my surprise, build throws the error below:
fatal error: module map file '/Users/macair/Library/Developer/Xcode/DerivedData/xyz_app6-gpxsmunajzbqoualaavtsfpnerep/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap' not found
What is wrong here? I haven't put any code into the app and it is all React Native generated code. Xcode becomes beast by itself even though the React Native app itself runs fine. That's why the app has to be rebuilt.
This seems to be a common problem. The solution works here is just open the myapp.xcworkspace in Xcode instead of myapp.xcodeproj. The build upon workspace went through without any error.

Flutter app uploading to AppStore Xcode error: Rsync failed

Whenever I try to Validate App after Archiving it in Xcode I get the following error popup:
Rsync failed
It then shows a 'Show logs.' button but when I select that it opens a folder called 'T' which contains many files and folders.
How can I see the logs that I need to fix this error?
Using Xcode 11.5
Usually the problem with Rsync is with the pods and the build itself. Try to run flutter clean, run pod install inside the ios folder, test your app in a real devidce, build the app and try again.

Can't find React native project on iOS Simulator or Xcode project

I have deleted my project on Xcode may it be .xcworkspace or .xcodeproj.
Because of that, I had to delete IOS and android folders while downgrading, updating and re-upgrading my react version to re-install IOS and android folders.
Thanks to that the emulator is working but unfortunately the project isn't present in the emulator and is still absent with Xcode. One thing to point out is that the simulator only appears when ran in the integrated terminal and nor in general terminal after cd-ing in the project folder.
Can anyone please help re-integrating the project in the emulator and on Xcode, please.
Here is the error when the emulator is running in a general terminal:
Here is the error when the emulator is running in a general terminal:
error Command failed: xcrun instruments -s
xcrun: error: Failed to determine realpath of '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk' (errno=No such file or directory)
xcrun: error: unable to find utility "instruments", not a developer tool or in PATH
Here is the error for building the project within emulator when ran from VS code integrated terminal:
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening project.xcodeproj
The process you need to follow is so similar to renaming a react native app. Basically you just need to run react-native upgrade in your root project directory. For further info you can check another question here. The instructions below explains how to create another react native project based on a copied one with a new name.
First copy the directory which your to-be-name-changed application exists. And go to your newly cloned directory.
Change the name at index.ios/android.js file which is given as a parameter to AppRegistry.
Change the name and version accordingly on package.json
Delete /ios and /android folders which are remaining from your older app.
Run $react-native upgrade to generate /ios and /android folders again.
Run $react-native link for any native dependency.
Finally run $react-native run-ios or anything you want.
Courtesy of
https://stackoverflow.com/questions/42506068/how-can-i-regenerate-ios-folder-in-react-native-project

Error: No pubspec.yaml file found. in MAC

I am new in flutter. After installation on MAC , while running "flutter run" in terminal , I got error as :
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Do not run this command from the root of your git clone of Flutter.
Anyone please can help me to fix this error ??
Assuming you did not create the project: Open Android Studio or your IDE and create a new flutter project. Also make sure that you set up your environment correctly like in the docs.
This command you are trying to run flutter run is meant to compile the project in the current directory and then run it on an emulator or device.

Resources