Could not find dart in flutter sdk in your flutter project? - ios

I am using mac and i have installed vs code ide for developement, now i am not able to create new project and no suggetions are given in the ide and also it does not found any error and also i have installed both the plugins i.e flutter and dart but still it is not working for me.

Run flutter doctor and post the screenshot here.
Run it in terminal "flutter doctor"

Have you downloaded flutter sdk from https://flutter.dev/docs/get-started/install/macos Despite plugins you also need this.

Related

I cant run my flutter project after updating to xcode 14... keep saying Unable to read project 'Runner.xcodeproj'

Unable to get Xcode project information:
2022-12-01 13:57:05.376 xcodebuild[71564:226197] Writing error result bundle to
/var/folders/6g/w7cqd0s54c33_20mrl4v2q640000gn/T/ResultBundle_2022-01-12_13-57-0005.xcresult
xcodebuild: error: Unable to read project 'Runner.xcodeproj'.
Reason: Project /Users/noel/Treegar/treegar-app/ios/Runner.xcodeproj cannot be opened because it is missing its
project.pbxproj file.
i keep getting this error when ever i run flutter run or flutter build ios.
i dont know what to do... it works fine on android but not on ios.
ive updated xcode and flutter same problem
flutter doctor -v
UPdate cocoapod to latest version
update flutter
update xcode
This error message indicates that the Runner.xcodeproj file is missing or cannot be opened.
This file is part of the Xcode project for your Flutter app and is necessary for building and running the app on iOS.
To fix this issue, try the following steps:
Make sure that you have the latest version of Xcode installed on
your computer. You can check for updates and download the latest
version of Xcode from the Mac App Store.
Make sure that you have the latest version of the Flutter SDK
installed on your computer. You can update Flutter by running the
flutter upgrade command in a terminal window.
Make sure that you have the latest version of CocoaPods installed on
your computer. You can update CocoaPods by running the
sudo gem
install -n /usr/local/bin cocoapods
command in a terminal window.
Make sure that you have a valid Xcode project file for your Flutter
app. If the Runner.xcodeproj file is missing, you can try running
the flutter create . command in the root directory of your Flutter
app to recreate the Xcode project files.
If the above steps do not help, you can try deleting the ios directory in your Flutter app and running the flutter create . command again to recreate the Xcode project files from scratch.
After trying these steps, try running the flutter run or flutter build ios command again to see if the issue has been resolved. If you continue to encounter errors, please provide more information about the specific steps you are taking and the full error message you are seeing.
try flutter clear and pubget.
or
try pod install
or
if it is not harmfull for your code try to delete ios folder and recreate it
in your project. may be this can work .

Android studio new version BumbleBee show error when run old project in IOS Device/Simulator in Flutter

It Will shows Error like this:-
After updating the Android studio it's throwing the error in IOS run
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 13 Pro Max.
It's run easily in android device and when we run through terminal its runs easily.
I have the same issue and I am hoping they will fix it soon. But, running flutter run from the terminal window inside Android Studio works fine and I can build and deploy for Android and iOS devices. Not a great solution, but works for now.
Upgrade with the new version of Bumblebee resolve the issue for me
Version: Android Studio Bumblebee | 2021.1.1 Patch 1

Android studio flutter project giving pod not installed error

I have already installed cocoapods in my Mac.
Cocoapods
$ pod --version
1.9.3
$ which pod
/Users/user/.rbenv/shims/pod
$ which gem
/Users/user/.rbenv/shims/gem
$ which ruby
/Users/user/.rbenv/shims/ruby
Problem
But if I add device specific codes like I setup firebase or add geolocator plugin, then clicking on Android studio Run green button, I always get below error:
Launching lib/main.dart on iPhone 11 Pro in debug mode...
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:
sudo gem install cocoapods
CocoaPods not installed or not in valid state.
Error launching application on iPhone 11 Pro.
What didn't worked
I updated Mac OS Catalina (10.15.6)
I re-installed cocoapods couple of times, with different approaches (with homebrew, with system ruby, with rbenv ruby)
Updated to latest xcode
It didn't worked
What works
Finally, if I run below command in terminal it is working as expected:
flutter build ios --simulator
flutter run
So, I think its an issue with Android Studio. anyone else facing this issue, and have workaround for this problem?
Requirement
I want android studio to run project when I click on Android Studio Run icon.
This is not a android studio issue, it is a pod version issue for flutter.
Please downgrade your cocoapods and try again.
Here is my solution.
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.7.5
pod setup
sudo gem install cocoapods
Update:
if you got still issue, please open it on xcode project and try run it.
once you fixed issue on xcode, it will work on android studio, too
Update 2:
please check your flutter sdk path. if there is any Capital letters, it can cause the issue.
Update 3: Try using Android Studio on termnial if all above methods do not work.
open /Applications/Android\ Studio.app
Try launching Android Studio from Terminal:
open /Applications/Android\ Studio.app
It would then use another PATH variable than if started with launchpad. And that PATH would contain valid path to CocoaPods.
Taken from https://github.com/flutter/flutter-intellij/issues/4981#issuecomment-751443625
Yes, It's an Android Studio issue and this worked for me
flutter clean in flutter project dir
In Android Studio: File > Invalidate Caches / Restart > Invalidate and Restart
Now the project should run on Android Studio when you click on the run button.
this is happened to me on vscode because cocoapods is looking for ruby version 2.6 and what I did to fix it with rbenv
rbenv global 2.6.8
gem install cocoapods
then restart vscode
I had tried a large number of options, but Android Studio continued to fail. So I tried using the Terminal options.
It is important to perform these while in the directory that holds your current project.
Once you are in the right place, type :-
flutter build ios --simulator
then type :-
flutter run
That compiled and ran my code correctly. Oddly it subsequently fixed Android Studio so that my code ran in the simulator without needing further input via the terminal.
Blockage cleared.!

New Flutter Project wizard not showing on Android Studio 3.0.1

I installed Flutter following official document and also installed Flutter and Dart plugin on Android Studio.
But, I can't see File>New Flutter Project wizard on Android Studio 3.0.1
I run "flutter doctor" command. See the below output.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D102, locale en-TR)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.0)
[✓] IntelliJ IDEA Community Edition (version 2017.3.3)
[!] Connected devices
! No devices available
! Doctor found issues in 1 category.
You need check the “AndroidAPK Support” in your Plugins.
See this screenshot:
If you are sure to have both Dart and Flutter plugins correctly installed, check again your Plugins and be sure that Android APK Support is enabled.
If it isn't, enable it!
Et voilà! Now everything should be fine:
You can find the plugin menu inside the Welcome page
or, when you have a project opened, inside the Preferences menu:
Had the same problem. Check-in Android Studio if the Dart and Flutter plugins are both installed and marked with a lock symbol in Preferences --> Plugins.
Anyway, the following procedure helped me:
uninstall the Flutter plugin
restart Android Studio.
uninstall the Dart plugin
restart Android Studio again which seemed important to do
install the Dart plugin again
restart Android Studio although it is annoying
install the Flutter plugin again
and guess: restart Android Studio
After the last restart I saw the success message:
I assume we both installed both plugins without restarting after Dart.
I also faced it but soon I solved it
I simply install flutter and dart plugins and restarted Android Studio.
After restarting I noticed that there is no Wizard for creating flutter apps. But soon I realized that I have disabled some plugins ( Android Studio's default plugins ) so I enabled all plugins and restarted Android Studio again and BOOM! Now there is a wizard for Creating Flutter Apps.
Hope this helps you !
My answer will be nearly same with #VickyBOSS but I'll upload screenshots of before and after ;)
First and foremost Flutter and Dart plugins must be installed before.
After installing these plugins you can check if it is ok or not with flutter doctor
If you hadn't installed the plugins you would have this:
Android Studio
At first, I didn't see "Start a new Flutter project"
After:
I have also same problem.but what can you do in that situation is Just create the project with command line :
flutter create your_app_name
Now open android studio and open that project. Hope this works well
Yes first update all your plugins related to flutter and dart .
"AndroidAPK Support" plugin(install /enable /update).
3.This will work for all the AS , checked this on AS 3.4 also .
Thanks to the guys who answered before me .
I also ran into this issue and the steps above didn't work. What I did was check which plugins I have enabled and realized that Android APK Support and Android NDK Support was disabled in my AS. After enabling this and restarting android studio everything seems to be working correctly.
This worked for me. Install Dart and Flutter manually from Plugins:
Open Plugins (For Mac: Configure -> Plugins OR Android Studio -> Preferences -> Plugins)
Search for Dart -> Search in repositories -> Install -> Restart Android studio
Search for Flutter -> Search in repositories -> Install -> Restart Android Studio
Got the same problem, fixed it by installing dart first using the plugin manager of android studio. Then install flutter plugin.
How to set flutter wizard in Android Studio 3.0
File > Close Project
Configure > Check for Updates
You will find Flutter and Dart updates. Update and Restart. Downloading Patch.
File > New Flutter Project or Select new Flutter Project.
Hope your problem resolved.
Happy Codings!!
It was little different in my case. After upgrading to newest release of Android studio. The dart flutter and other related plugins were in incompatible mode.
You can check that by going to Android Studio=> Plugins.
I simply update those plugins and then restart the IDE and it works fine.
Just Restore your IDE settings as shown in image
File -> Manage Ide Settings -> Restore default settings
This will remove your installed plugins and ask you again to install them.
Update flutter using below command
flutter upgrade
and again create flutter application from android studio
For some reason, Flutter refused to show New Flutter Project in android studio 3.1
but when I use android studio 3.2 it works fine after installing Dart and flutter plugins.
Make sure you have flutter and dart installed, then enable Android apk support; this helped me
Uninstall Flutter and Dart plugin
Restart Android Studio
Install Flutter Plugin (it will prompt you to install Dart plugin as well. Accept it)
Restart Android Studio
Also, reminder to check whether the plugin is enabled or not. Go to Preferences -> Plugins -> Flutter/Dart. Although, it's enabled by default, you may have had to disable it at some point in the past. In that case, just enable it from Preferences -> Plugin -> Flutter/Dart if you want to.
In my case I did not have APK/NDK support Plugin, added that and it worked. Of course restart IDE couple of times.
Well go to command line and check flutter doctor , if all good give command to your project directory
flutter create appname
and import this to androidstudio , this will generate necessary plugins.
I've got the same problem and finally sorted out. It's usually caused by your upgrade of Android Studio from 2.x to 3.x at the same time.
In short, it's because Flutter is not correctly configurated, but behind the scene there might be different reasons, so the universal solution is to run flutter doctor -v to diagnose and see what's missing.
[First make sure you've already followed the setup steps in Flutter's official documentation and have your Android SDK updated.]
In my own case, a couple of things to fix:
Update the JAVA_HOME path in .bash_profile. Because I have 2 Java versions installed and so I updated it to use the same as Android Studio does. This is critical as flutter doctor relies on Java to check some of your configurations.
Some Android licenses not accepted - follow flutter doctor's advice to accept all licenses.
Android Studio's Flutter plugin version too low - simply update it.
Even if you have done everything here,it may not work if you have Android Studio 4.x or canary
It works only in lower version
In my case I only miss Dart plugin so i installed and on IDE restart it was there

Can't build a flutter project with PathProvider dependency

Disclaimer: First of all, this is my early attempt to play with Flutter. So forgive me if is a noob question.
I had been playing with an MVP-Clean architecture for Flutter apps in iOS, and when trying to build a data source where I can persist data easily I found PathProvider plugin.
After trying the next:
Add dependencies to the project
dependencies: path_provider: "^0.4.0"
Provide dependencies
flutter packages get
pod install
I try to compile the project and the compiler shouts:
** BUILD FAILED **
Xcode's output: ↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/proect_directory/ios/Runner/GeneratedPluginRegistrant.m:6:9:
fatal error: 'path_provider/PathProviderPlugin.h' file not found
#import <path_provider/PathProviderPlugin.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
I did a quick search and I did not find anything useful.
Could anyone illuminate my path?
EDIT:
Already tried with:
flutter update-packages --force-upgrade
And the doctor output does not show any errors:
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D102, locale
en-ES)
[✓] Android toolchain - develop for Android devices (Android
SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.0)
[✓] IntelliJ IDEA Community Edition
(version 2017.3.4)
[✓] Connected devices (1 available)
This issue should be fixed by https://github.com/flutter/flutter/pull/15437
To apply the fix to an existing project, add these lines to ios/Podfile.
I finally find a workaround.
I went to the GitHub repo, found the PathProviderPlugin.h file, and put it inside the location:
build/ios/Debug-iphonesimulator/path_provider/path_provider.framework/Headers/
Sounds a little bit dirty, but was the only way to keep coding.
Hope helps someone. And thanks to #GünterZöchbauer to help me find a useful lead.
Open the project in xcode. i.e On Android Studio, right click -> Flutter -> open in xcode.
Find the PathProviderPlugin.h file. (Find -> Find in workspace -> 3. PathProviderPlugin.h)
Click on the result. In case you cannot find the result, right click on the PathProviderPlugin.m file and choose 'Reveal In Project Navigator'
There you will see PathProviderPlugin.h file.
On right hand side, target membership, change the settings from project to public.
Do this for any files for which compiler is complaining, till you are able to build your project.
Check the image for reference. Use the highlighted button to open right hand panel (Added For Android devs who don't know much of xcode. :) )
i have just deleted the podfile.lock and podfile then i run the command flutter build ios ,it install podfile and podlock perfectly but build was failed because i didnt set the team for provision, so then i came to the terminal of android studio and run the command flutter run and it works!...
For me this was solved by editing podfile as mentioned by this https://github.com/flutter/flutter/issues/10654#issuecomment-389034245 and change the xcode's build system to legacy.
I encountered a similar issue and solved it with these simple steps:
Delete the .pub-cache folder inside the Flutter SDK
From the root directory of the flutter project, command flutter clean then flutter pub get

Resources