I get this error when I try to run my flutter app on Macbook Pro:
Launching lib/main.dart on iPhone 12 Pro Max 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 12 Pro Max.
This is my first attempt to run this app on a mac. I have installed cocoapods and the simulator I have is iPhone 12 Pro Max - 14.3. I am doing this in Android Studio.
I am new to macs and this has been a lengthy task trying to get this to run on mac. Any suggestions?
Run pod update in your pod file and clean the flutter project and try to run
command for pod update
pod update
command for flutter clean
flutter clean
Related
Error occurring:-
pubspec.yaml file:-
Podfile:-
Below are solutions I tried but still the app don't build on iOS Simulator on MAC m1.
Tried running pod init and pod install in iOS directory.
Tried running flutter clean and flutter pub get.
Tried re-installing the CocoaPods.
Tried updating the Xcode command line tools.
Tried deleting and again downloading the common line tools.
Tried updating the Xcode to latest version
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 12 Pro Max.
I'm unable to test my flutter application on VSCode which is running on catalina on vitual box.
After launching application from VSCode, I am just getting single line error Error launching application on Najam’s iPhone. and then application is opening in the device but it is then disconnected with VSCode
Launching lib/main.dart on Najam’s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: H5PHS46J86
Running pod install... 277.5s
Running Xcode build...
└─Compiling, linking and signing... 114.5s
Xcode build done. 346.8s
Installing and launching... 59.8s
Error launching application on Najam’s iPhone.
What I've tried
As suggested here https://github.com/flutter/flutter/issues/69632#issuecomment-803646337, I tried below solution but it didn't work for me
Setting platform to 10.0 inside the Podfile (platform :ios, '10.0' )
Doing a combination of flutter clean, pod cache clean --all and pod install
I also tried this solution too https://stackoverflow.com/a/64661277/7290043. But it didn't work either.
flutter clean pod cache clean --all
rm -rf ios/Flutter/Flutter.framework
flutter pub get
pod install
flutter run
What should I do?
The time to launch is very long. What type of machine are you building on? VSCode debugging might just be timing out. Try running directly from xcode and a) see if it remains connected, and b) see if any further errors are reported
Same issue, I fixed it:
flutter/bin/cache,delete flutter_tools.snapshot and flutter_tools.stamp;
flutter/packages/flutter_tools/lib/src/ios/devices.dart, find 'await observatoryDiscovery.uri.timeout(const Duration(seconds: 60))'
Then change 60 to 240
flutter run
wow, success
Is there an issue with Flutter iOS apps on an iOS simulator (iPhone 12 Pro Max) running on an M1 Mac with Big Sur 11.2.2 and Flutter 1.22.6 ?
You see, my Flutter iOS app (using multiple Flutter plugins) was developed on an Intel-based Mac running Catalina (10.15.7) and Flutter 1.22.5 and it works, but when I moved to an M1 based Mac running Big Sur and Flutter 1.22.6, I’m having the Cocoapod’s error:
[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile.
Note that on this M1 mac, 'flutter doctor' is successful and I can create the Flutter test app and run it on an iOS simulator so I think its setup properly.
I have also tried the solutions suggested with past posts having this symptom to no avail. I have tried the following:
1- I uncommented the line 'platform :ios, '9.0'' in my pods file.
2- I ran the following CLI commands in the terminal:
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
cd ios
pod install
cd ..
flutter build ios
The result of trying both suggestions above is the same 'Error running pod install' error with no other error messages mentioned.
The only thing I can think of at this point is that there is a problem with the Flutter plugins I am using when running in an iOS simulator on an M1. Again, these plugins work on an Intel-based Mac running Catalina. If so, unfortunately, the error doesn’t tell me which one. The plugins that I use are:
dependencies:
flutter:
sdk: flutter
provider: ^4.1.3
sqflite: ^1.3.2+1
googleapis: ^0.56.1
googleapis_auth: ^0.2.12
http: ^0.12.2
url_launcher: ^5.7.2
flutter_secure_storage: ^3.3.5
tuple: ^1.0.3
image_picker: ^0.6.7+12
intl: ^0.16.1
fraction: ^1.2.1
archive: ^2.0.13
path_provider: ^1.6.24
path: ^1.7.0
image_cropper: ^1.3.1
flutter_image_compress: ^0.7.0
All help / suggestions greatly appreciated.
It's not yet supported (Coming in this PR)
Flutter has disabled running on simulators running on ARM architecture. They've done this because a flutter dependency (iOS engine Flutter.framework) didn't have arm64 slices. There is an open pull request to add support for iOS simulator on M1 macs (arm64): https://github.com/flutter/flutter/pull/85059
I initially tried to get this working for myself, but the issue is Generated.xcconfig contains code which disables arm64 architecture for the simulator, and this file is generated by Flutter internally. Once you manually change this, it still fails. If you tried to build with Xcode, you might get this error message during the linking process:
Undefined symbol: _OBJC_CLASS_$_ClassName
and lots more. I'd recommend building with Xcode if you don't see enough logs or information to debug the build process.
Automatically assigning platform is not an error
Automatically assigning platform iOS is not actually an error, it's just telling you its defaulted to iOS platform. It then failed, so in this case, you should've provided more error information.
I also faced this issue.
Update iOS version to 10.0 in the podfile.
It worked for me.
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.!